I almost feel like I should be posting this in bug reports, but since I’m a beginner, I’m going to assume I’m not understanding how GDevelop reads events. I’m working on a test adventure game. I want to have a map that shows the player’s current location based on scene. The map will be click-draggable, so I only want the camera to center on the current location when it’s opened (triggered once). I copied/pasted the exact same events from one scene to another, and it works with one (HauntedHouse), and not the other (CastleRuins). I really want to understand the fundamentals here to explain why this is happening. I suspect it’s because I have the “center camera on object” in the same event as the “change position of object”, but even when I tried to move it to another event triggered by a variable, HauntedHouse works, CastleRuins does not.
The test map (stick figure drawing object) is one sprite object as a large image
My global variable, “PlayerLocation” is set to “string” so I can reference the scene name easily
Also, I’m sensing this has something to do with the timing/order that events are read. But I still don’t understand why the exact same events are behaving differently. I’d love for there to be a “wait for action completion” action to prevent Gdevelop from getting ahead of itself. It seems like the PlayerLocation object is still being moved, so the ‘center camera on object’ isn’t working? I dunno. I’m new here.
Thanks for the reply MrMen! Nope, no other events in the map scene. I started this project just to test the map idea, so there’s nothing to this project outside of what you see.
Alrighty, MrMen—Since you pointed me to the Map scene being the source of the problem, I started messing around and it looks like I got it to work by moving the “at beginning of scene” condition/event to the top of the order (also got rid of the “trigger once” for the beginning of scene, since it seems redundant).
Just so I can understand how Gdevelop works—and solve problems more effectively—can you explain why moving that condition/event to the top made a difference? And why did one event work while the other didn’t in my previous setup? They were copied in every way except for the variable string.
GDevelop processes the events from top to bottom, and each action likewise in each event. I don’t know why this made a difference in this case - the original first events didn’t appear to affect the beginning of scene event, and it’s not uncommon to see a few beginning of scene event scattered throughout people’s code.
There may be a reason for it that the GDevelop developers/makers can identify. But that’s beyond my realm of knowledge.
Anyway, good to see you have it working. Good luck making the game
That does intrigues me, would you mind sending a stripped down version of the project (or a build of it) for me to look at what is happening with the generated code?
Thanks for your help MrMen! I did know that Gdevelop reads events from top to bottom, but since I was just messing around and my other event didn’t affect the beginning of the scene, I left it at the bottom. When I’m working on stuff for real I have been trying very hard to keep a clean event sheet, and it makes sense to me to have the Beginning of Scene events at the top.
Arthuro, I’ll try to figure out how to get you a copy of the project!