Allow player to set time limit/score limit

id07

Member
I'm wondering if someone could please point me in the right direction on achieving this for my game. I would like to allow a player to set a time limit and score for small basic game, and then when that limit is set, they start the game, and when it either the time limit or score limit is reached, the game will end.

One method I thought to do, is put the option objects in a menu/room, and I would allow the player to pick the timer themselves among 4 object timers, and same for the score limit with 4 different objects. If they clicked and made their choice, it would check the instances and delete the one not selected and use those as the timers in the next room. This is the possible method I could do, because I think I could do that, but if there's a better way, and easier way, I would greatly appreciate the help -- I'd like it to draw/show the countdown on screen.

Not sure how complicated it would be to have them manually input mins and secs compared to my method.

I appreciate anything! Thank you.
 
L

Luto

Guest
maybe something like this. you need have a preview design of the menu because the function "point_in_rectangle" need the coordinates of the boundaries of the edges of the buttons that in this case are specified zones of the room (time set up/down etc). it is only a sketch. i not tested the code. also you need use the draw event to do the push animations of the buttons. i am not expert but 1 object is better than 4 or more i think. i wrote this with the windows notepad, check for errors because i dont have GM in this machine.
////in control_obj
////in create event////////////////////////////////////////////////////////////////
globalvar time;
global.time=10; //default time limit
score=1000; //default score limit
timemode=0;
////in mouse left button pressed event/////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
if point_in_rectangle(mouse_x,mouse_y,x1,y1,x2,y2) //TIME MODE selector SECONDS(0) or MINUTES(1)
{
timemode++;
if timemode>1
{
timemode=0;
}
}
///////////////////////////////////////////////////////////////////////////////////
if point_in_rectangle(mouse_x,mouse_y,x1,y1,x2,y2) //UP time limit selector
{
if !(global.time==30) //30 is the max time
{
global.time++;
}
}
if point_in_rectangle(mouse_x,mouse_y,x1,y1,x2,y2) //DOWN time limit selector
{
if !(global.time==0) //1 is the min time and 0 is not limit
{
global.time--;
}
}
///////////////////////////////////////////////////////////////////////////////////
if point_in_rectangle(mouse_x,mouse_y,x1,y1,x2,y2) //SCORE limit selector
{
if !(global.score==10000) // 10000 is the max score
{
score++;
}
}
if point_in_rectangle(mouse_x,mouse_y,x1,y1,x2,y2) //SCORE limit selector
{
if !(score==0) // 1 is the min score and 0 is not limit
{
score--;
}
}
///////////////////////////////////////////////////////////////////////////////////
if point_in_rectangle(mouse_x,mouse_y,x1,y1,x2,y2) //READY button
{
if !(global.time==0) //negate if the time is not limit
{
if timemode==0 //selection time in seconds
{
global.time = (room_speed * global.time);
}
if timemode==1 //selection time in minutes
{
global.time = ((60 * room_speed) * global.time);
}
}
room_goto(map_combat);
}
 
Top