Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,649 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
restart the game #300749
12/04/09 20:45
12/04/09 20:45
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
hopfel Offline OP
User
hopfel  Offline OP
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
Hi, I'm programming on a 2D game and now I want to include a restart function. How can I do this? I tried to save the game at the begin and then to load it to restart, but it created and changed any panels during the game so I've got an error.
Is there a way to delete everything who hinder the game_load or is there another way to restart a game (sans exec and sys_exit)?


Hilf mir, dir zu helfen!
Re: restart the game [Re: hopfel] #300750
12/04/09 20:56
12/04/09 20:56
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Do you use panels for the 2D game?
Then starting a level won't help you anything.
You have to write your own starting and closing routine.
You could write an init function to reset all values and positions, to set the panels to visible or invisible, just like you need it at the beginning of a level.

Re: restart the game [Re: Pappenheimer] #300788
12/05/09 09:24
12/05/09 09:24
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
hopfel Offline OP
User
hopfel  Offline OP
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
I made a spelling mistake, I would say game_load and not level_load, but your answer also answered my question. Ok, lets do it on the complicated way >.<
Thx for your answer wink


Hilf mir, dir zu helfen!
Re: restart the game [Re: hopfel] #300824
12/05/09 16:05
12/05/09 16:05
Joined: Oct 2009
Posts: 90
WickWoody Offline
Junior Member
WickWoody  Offline
Junior Member

Joined: Oct 2009
Posts: 90
If you make a 2D game, I think reset values etc. . Or first open game with use exec, later close first game with sys_exit.

Example for my second suggestion:
Code:
function restart_game()
{
  exec(GAME EXE's NAME, ""); // for start game
  wait(1); // wait sometime
  sys_exit(NULL); // exit previous game
}

function main()
{
  on_enter = restart_game; // on enter key run function
}



Last edited by WickWoody; 12/05/09 16:07.
Re: restart the game [Re: hopfel] #300827
12/05/09 16:53
12/05/09 16:53
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
hopfel Offline OP
User
hopfel  Offline OP
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
Originally Posted By: hopfel
or is there another way to restart a game (sans exec and sys_exit)?


With exec and sys_exit it's an ugly restart, and I don't know a game who restarts at that way...
but anyway thx for your answer.


Hilf mir, dir zu helfen!
Re: restart the game [Re: hopfel] #301935
12/15/09 14:09
12/15/09 14:09
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
hopfel Offline OP
User
hopfel  Offline OP
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
Ok, I tried to make a restart function, but it don't works; it's very strange, I wrote this function for the restart:

function restart()
{
stopper=1; //<-- delete all Panels, Entities etc.
while(!key_q){test+=2*time_step;wait(1);} //<-- test-counter, I can see it ingame with digits(...);
media_stop(0);
sys_exit("");
}

When the Function starts, the test-value count up and stops at 0.65, but I didn't press the 'q' key. The function stops groundless; it gets stuck. It didn't react if I push 'q'. I can move the mouse, so the Engine didn't crash.
Do someone knows, what might be the fault, that a function can get stuck?
Thx for help ^^


Hilf mir, dir zu helfen!
Re: restart the game [Re: hopfel] #302252
12/18/09 00:36
12/18/09 00:36
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
you're best off justing using reset for each panel

function restart(){
set(pnl_main, SHOW);
reset(pnl_this, SHOW);
reset(pnl_that, SHOW);
reset(pnl_other, SHOW);
}

then triggering this at the start, and set any positions, values, digits that need ot be set inside this function

Re: restart the game [Re: MrGuest] #302333
12/18/09 16:39
12/18/09 16:39
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
hopfel Offline OP
User
hopfel  Offline OP
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
The problem is, every Panel has his own function. So, I tried this in the Panel-function:

if(stopper==1)
test_pan.flags=NULL;

But the function gets stuck... It must be another function but I can't understand it... How can a function get stuck groundless?
If I know how a function can get stuck, I can find the fail, perhabs.


Hilf mir, dir zu helfen!
Re: restart the game [Re: hopfel] #306808
01/25/10 04:06
01/25/10 04:06
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
A reset function is simply a level star function. It should do EVERYTHING. Set every var that is needed in the start position.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1