Reseting the game easily

For questions about using Classic.

Post » Thu Apr 30, 2009 7:03 pm

As the subject says, how to reset the game easily? Some kind of code needed?
B
1
G
3
Posts: 4
Reputation: 833

Post » Thu Apr 30, 2009 7:31 pm

Reset it how? As in, start the level again? Start the game over again? More information is needed here. What needs to be reset? Score? Ammo? Lives? Enemy placement? Bananas?

Also, what have you tried in order to reset your game? It's easier to help out with a method that doesn't work than to come up with something from scratch that might not even fit into your game.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Apr 30, 2009 7:55 pm

I meant same as you would push the magical red x and start playing again from the beginning. There's just too many variables to set them all to original values at the "Game Over press space to continue".
And i mean reseting enemy hp, tower reload time, and other attributes.
B
1
G
3
Posts: 4
Reputation: 833

Post » Thu Apr 30, 2009 8:03 pm

[quote="Verfin":2192jahm]I meant same as you would push the magical red x and start playing again from the beginning. There's just too many variables to set them all to original values at the "Game Over press space to continue".[/quote:2192jahm]

Ah, I see.

Well, currently that's the only way to do it, unfortunately.



Actually... I suppose you could Quicksave at the beginning of your game when it first starts up, then use Quickload to return to that state. I haven't used Construct's built-in save features much, but as I understand it it's akin to a save state for an emulator. I think.

If your game is big on memory resources you could save/load from disk. I don't imagine it would take too much time to restore. You could hide the load time with a fade transition or something to a blank, black layout if it's got a noticeable lag.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Apr 30, 2009 8:09 pm

Good thinking, tho the programm bugs right after the quickload. Gotta do it the slow way then. Thanks anyway.

E: That was just the first time, now it works perfectly. Although the music stops playing, but its just about the codings..
B
1
G
3
Posts: 4
Reputation: 833

Post » Thu Apr 30, 2009 10:15 pm

change layout to current layout is a quick way, u only need to reset global variables, thats why you should avoid them except when you want trans-layout variables
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun May 10, 2009 9:46 pm

What's the easiest way to change to the current layout? I'm assuming that I need to use the action System -> Go to layout, but how do I get it to pick the correct layout? I suppose I could create a separate reset event for every layout, but I'd rather create a single reset event that works properly no matter what layout it's called from. Is there a system variable that keeps track of the current layout number that I can use?

I have to say, the layout system confuses me a bit (I'm pretty new to Construct). The layouts are listed by name in the Project panel, not number, and the Properties pane for a layout makes no mention of a number, but when you use the 'Go to layout' action it asks for a number. Not very intuitive.
B
1
G
3
Posts: 6
Reputation: 837

Post » Sun May 10, 2009 9:54 pm

You can enter a name for the layout parameter. Also have a look at the system expressions:
[quote:36v1yo3b]LayoutName
The name of the current layout.

LayoutNumber
The current layout's number.[/quote:36v1yo3b]
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Mon May 11, 2009 7:51 am

Perfect! Using 'LayoutName' in conjunction with the System -> Go to Layout action allows me to reset the layout using one abstract Event, no matter which layout the player is on. Thanks Ashley!
B
1
G
3
Posts: 6
Reputation: 837


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests