Ask here your questions to get help using GDevelop.
By Mats
#43406
komencanto wrote:"Go to scene" still not working. I suppose to make it work I need to have at least 2 scenes, for example, "game" and "game over". Then during switching between them they will restart.


Just do Go to scene "nameofthecurrentscene"
Tried with 2 scenes - in Preview can see only one and message that in compiled game I'll go to another scene. So, no switching, no restarting.
Tried to compile the game - Player stuck between coins - can not collect them - moving away from them like from walls. In preview there is no such problem. Added condition to "move away": "If Player collide with wall" - the same problem. :?


Perhaps you should include your project file with your post so we can see what the problems are?

So, in GD command "wait 3 sec" or "pause 3 sec" consists from 2 lines: "Reset timer" where you want a pause and "Value of timer is >3" to tell that pause is 3 sec?
[/quote][/quote]

Pretty much.
By komencanto
#43411 [OK, I got it about Restarting the game. When yo use the action "Go to scene" you are restarting Events for this scene but not its initial look (like in the Scene editor). To restart the scene itself you use the condition "At the beginning of the scene" and for every sprite on the scene which can change its position during the game you need to add its initial position which I assumed will be performed automatically. I think it is possible to create an action "Restart the game" which will do it for you.] WRONG, just there is no switching between scene in the Preview mode.

[And about moving away from coins instead only from walls in the compiled game, I suspect this is a bug.] The bug is in my project. The game constantly restarts - just need to reset timer in the beginning of the game.
Last edited by komencanto on Sat 28 Jun 2014, 22:01, edited 1 time in total.
By Mats
#43420
komencanto wrote:OK, I got it about Restarting the game. When yo use the action "Go to scene" you are restarting Events for this scene but not its initial look (like in the Scene editor). To restart the scene itself you use the condition "At the beginning of the scene" and for every sprite on the scene which can change its position during the game you need to add its initial position which I assumed will be performed automatically. I think it is possible to create an action "Restart the game" which will do it for you.


Go to scene "scenename" should load the scene exactly in its start state (it does for me)? Are you using the latest version of GD?

And about moving away from coins instead only from walls in the compiled game, I suspect this is a bug.


It's really impossible to say unless you show us the events you're using or upload the file, however, I strongly suspect it's not a bug. I haven't yet encountered any bugs with collisions of this kind.
By komencanto
#43422 OK, now I succeeded to compile the project again and everything works fine: I can collect coins and restart the scene. But during the preview restarting of the scene doesn't work.
(8.01 KiB) Downloaded 149 times
By komencanto
#43428 Here is an example where the Player stucks between the coins in compiled game but moves normally collecting them during the preview. Can't make the timer work either.
(9.52 KiB) Downloaded 149 times

Here is the lines with the timer:
Attachments
timer.png
timer.png (7.7 KiB) Viewed 5024 times
By Mats
#43429 For the timer - You must only reset the timer once! In your code, you are resetting the timer constantly once there are no coins left. You can do something like:

Conditions:
Number of coin = 0
Number of door = 0
Variable end = 0

Actions
Show object gameover
Reset the timer "pause"
Do = 1 to Variable end

This way, the timer will only be reset once. You could also use 'trigger once' condition instead to do the same thing. Edit: You also must reset this timer at the beginning of the scene.

At the beginning of scene | Reset the timer "pause"

For the hero getting stuck in compiled game.

Perhaps it is because you have no conditions on your move hero away from door and move hero away from wall events. It should look like this:

hero is in collision with wall | Move hero away from wall

hero is in collision with door | Move hero away from door
By komencanto
#43431 Resetting timer at the beginning of the game unstucks the Player, so now he moves normally in the compiled game just like in the Preview. But still why Preview and compiled game behaved differently is a mystery for me. A bug?

Can not find in Actions "Trigger once". Can see it only in Conditions (Advanced), not Actions.
By Mats
#43432
komencanto wrote:Resetting timer at the beginning of the game unstucks the Player, so now he moves normally in the compiled game just like in the Preview. But still why Preview and compiled game behaved differently is a mystery for me. A bug?.


Because the preview does not support switching scenes. If you do not reset that timer, the scene is constantly resetting in the compiled game (because the timer has a junk value and so the condition timer > 3 is always true).

Edit: Basically, it's good practice to reset timers before you use them.