Posted By: gagamBRYAN
play again.. help! - 02/04/09 17:35
hi everyone,
there is something wrong with my game. All the game would probably have the "play again?" message with a yes or no button, asking if you are going to play the same game or not.. Now my problem is that the play again function don't work. i just point it to the SAME function that the game uses the first run,. but the problem is that it just load only the entities and no action at all..
what should i do?
![frown frown](/ubb7/images/graemlins/default_dark/frown.gif)
tnx.
Posted By: Kaizen_31
Re: play again.. help! - 02/04/09 17:37
what's the code of your function?
Posted By: gagamBRYAN
Re: play again.. help! - 02/04/09 18:26
it's a to0 long code bro,. hehe.. but the thing is that it works on the first run of the system, i just point it in the same function, but it doesnt work.
algorithm is like below:
function playagain()
{
laod_entity();
}
action move()
{
......ent_animate
if enemy or player' health==0
ent_animate(death)
playagain();
}
function load_entity(){
ent_create("player.mdl", vector(0,-100,-10),move);
}
Posted By: Kaizen_31
Re: play again.. help! - 02/05/09 19:51
wahhh i dont understand that code that you've post
Posted By: gagamBRYAN
Re: play again.. help! - 02/06/09 04:41
no bro, sorry its my bad.. its a typographical error. ahehe
![smile smile](/ubb7/images/graemlins/default_dark/smile.gif)
ahmm.. can you help me make an algo for the play again?.. or conditions and looping that u r using,. maybe i can apply that in my game.. thanks!
Posted By: Jaxas
Re: play again.. help! - 02/06/09 08:58
first of all, you should load same level again if you want to play again, i think. But i don't understand what exactly you want to do..
Posted By: gagamBRYAN
Re: play again.. help! - 02/06/09 15:33
ahmm.. what i want to do is to re-load again the entities and all the actions and animations.
Posted By: WretchedSid
Re: play again.. help! - 02/06/09 15:36
hmm... you can kill all running functions with proc_kill(16); and then just call your main function again and the game should restart.
Posted By: Jaxas
Re: play again.. help! - 02/06/09 15:58
maybe you store your player position and load level and place him in that position
![wink wink](/ubb7/images/graemlins/default_dark/wink.gif)
and as i said, you don't describe the situation..
Posted By: gagamBRYAN
Re: play again.. help! - 02/06/09 17:16
@Jaxas:
the player position and loading of level works. but the function specifically the fighting of entities dont work anymore.
@Sylar:
hmm... you gave me an idea there.. i'd try to proc_kill(16), and it works for the stopping of function but sad to say the mouse also stops. ahehe.. ahmm.. can i call the "function main()" inside other function?.. how can i call it?
thanks!
Posted By: WretchedSid
Re: play again.. help! - 02/06/09 17:36
You must call all nedeed functions again, so I would recall the main function which calls all nedeed functions...
function restart_main();
void main()
{
level_load("test_level.wmb");
}
function restart_main()
{
main();
}