ESCAPE KEY???

Posted By: carla_mariz

ESCAPE KEY??? - 01/14/11 07:06

can someone pls help me about this problem?
i want my game to pause and show menu when key_esc is pressed..
but i have no idea. frown

pls help.
Posted By: 3run

Re: ESCAPE KEY??? - 01/14/11 07:13

Why don't you look in one of the MENU examples from AUM? It was some were in 68-69 I guess.
Posted By: carla_mariz

Re: ESCAPE KEY??? - 01/14/11 07:18

uhm..i found some and i tried it.. but when i run the script, it exits.. frown

is there something wrong with this?
Code:
function pause_escape()
{
   freeze_mode = 1;
   pause_panel.flags = SHOW | OVERLAY;
}

function main()
{
   on_esc = pause_escape;
   screen_size.x = 800;
   screen_size.y = 600;
   sun_light=100;	
}




what do you think?
Posted By: 3run

Re: ESCAPE KEY??? - 01/14/11 07:21

carla_mariz did you finish Workshops? Script is so simple and you can't see what is wrong here?
Posted By: carla_mariz

Re: ESCAPE KEY??? - 01/14/11 07:28

no i did not..i have no time to finish workshops because of the deadline of the project. well sorry for that, i'm not a good programmer like you. thanks anyway, you've been helping me a lot. i'll search GST again.
Posted By: bk9iq

Re: ESCAPE KEY??? - 01/14/11 07:33

ok so just make a copy of the default.c file and then delete the line::
if (!on_esc) on_esc = def_exit;
so that the engine never exits upon pressing escape ....
I am not sure whether there's a better way or not but this does work...

In addition u need to make some corrections to ur code...

Posted By: 3run

Re: ESCAPE KEY??? - 01/14/11 07:34

Carla listen to me, it'll be very hard for you to go on, if you not gonna learn basics from Workshops.
You'll spend a lot of time just for nothing without basic knowledge, I know that by myself.
Start learning Workshops today, they are very easy and you'll need just few days to finish them.
Your project can wait, other ways it'll stuck for a very long time.
Posted By: carla_mariz

Re: ESCAPE KEY??? - 01/14/11 07:35

thanks @bk9iq, i'll try that laugh
Posted By: carla_mariz

Re: ESCAPE KEY??? - 01/14/11 07:44

@3run..ok ok, i'll finish the workshops, but i guess not now. grin
i barely have 2 weeks to go , and i thought asking from the forum would make it easy for me. grin grin grin tnx for reminding me , i really appreciated it laugh
Posted By: Rasch

Re: ESCAPE KEY??? - 01/14/11 08:57

Originally Posted By: bk9iq
ok so just make a copy of the default.c file and then delete the line::
if (!on_esc) on_esc = def_exit;
so that the engine never exits upon pressing escape ....
I am not sure whether there's a better way or not but this does work...

In addition u need to make some corrections to ur code...


in your function main() just add:

on_esc = NULL;
© 2024 lite-C Forums