[DIV/FENIX/BENNU] "refresh" a level?

Started by MisterN, August 07, 2011, 09:35:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

For example, when you die in mario, the screen fades out, 3-5 seconds later it fades in, and the level is "refreshed" so anything you did checkpoint A (the level start) to checkpoint B (the level end) in undone. Do you know of any way i might be able to do that? Originally I had something in my code called spawn. and when spawn was true, it would spawn everything then make itself false. There were many problems with this such as music not playing, duplicates of objects, etc. Is there a signal somewhere that will "refresh" the level like I am talking about? Thanks
werg

l1nk3rn3l

we use 2 methods:


1. option (more slow)

main process()
{
   if (player_die)
  {
     let_me_alone() ---->>  kill all process( gombas, trees, mushrooms, etc)
     if (lives>0)   
       load_level(current_level)   -->> load level again
  }

}







2. option (more fast) not kill process only hide objects(goombas, mushro..) out in screen when die
and restoreit when playerdie..

main process()
{

   if (player_die)
  {     
     if (lives>0)   
       restore_level(current_level)   -->> restore x,y coordinates from process and moveit original x,y
  }

}

MisterN

my levels are .prg files, and in each .prg file the level is a FUNCTION. is there anything I need to change and how would I change it?
werg

MisterN

#3
theres no such thing in the wiki as reload. load_map didnt work cause once i did let_me_alone the game crashed lol. ill find another place for let_me_alone.

EDIT: Nope doesnt really work anywhere
werg

handsource-dyko

You have to be carefull with let_me_alone(), it kills all processes, execept the one that calls this function. When you kill processes, you should always check if they exist, with the exists() function, otherwise processes that check for collisions or do anything with other processes will try to check for an non-existing process. The result: Crash! ;D

MisterN

werg