Hi everyone. I followed the youtube GDevelop tutorial for making a sokoban game
But more specifically I used the game example link in the bio.
(I can’t post the link but its easy to find on youtube)
I recreated all of the events, objects, scene variables, object group variables etc - But when I try to preview the scene, as soon as I press a button the webpage with the preview and the Gdevelop webpage itself freezes and stops responding.
I’ve attached a photo of the game screen and will reply with photos of the events. Any help is hugely appreciated please !
GDevlop variables are case sensitive. So “Xmove” is a different variable to “XMove”.
When you check for key presses you change the variables Xmove and Ymove, both with a lowercase “m”.
When you update the marker position in the while event, you are using XMove and YMove, with uppercase “M”. Because these variables haven’t been set, they will have a value of 0, causing the while event to loop infinitely.
Now when I press the keys though, the marker just moves to the spaces as seen in the picture below. Could you advise what might be happening here and how to fix it?
Not all conditions are covered to remove the existing marker. Only when marker is on a TileMap, a filled goal or an Object does it get deleted. But if it’s none of those, then marker is untouched.
I’d suggest adding a delete marker action in the event that sets Xmove and Ymove to 0 (just before the “Reset Game” event group). At that point you’ve finished with it, and it’s no longer needed.
I just tried that and now the markers aren’t appearing, but also nothing is happening when I press the keys. I don’t understand because I copied the original game design exactly (or at least I think I have)
Correct. As soon as they’ve finished their job they are deleted. It all before the scene is refreshed, so you won’t see them.
It may be because you’re creating marker at baby_2’s position. Unless baby_2 is a member of the Objects object group, I’d suggest you create the marker at “baby_s.X() + Xmove” and “baby_s.Y() + Ymove”.
Baby_2 is a part of the Objects group and so is Brick, which both have the variable
“Direction, Text = None”. marker is not in the group but also has that variable attached to the object. I changed it to what you said and still nothing happens when I press the keys. I will screenshot the events page again and put one screenshot here and another in another reply.
Everything is on the base layer if that changes anything.
Scene variables are Xmove number zero, Ymove number 0 and LockControlToggles Boolean false
I’ve also never used the TileMap function before so was kind of guessing there
maybe the issue is with: Change the variable direction of objects: set to Move ? Move isn’t something I’ve written anywhere else in the game, unless its just an inherent thing Gdevelop recognises ?
And I can’t see how that parent event ever gets actioned. Marker is being moved in the previous “While” event until it no longer collides with Objects.
Can you drag the subevent (in my screen snip) to the left by 1 level, so it’s in line with its parent event? You can then delete or disable what was the parent event. That should get the objects moving.
I just did what you said, and now when i press the up key, one of the bricks moves, but nothing responds to the left or right key, and baby_2 doesn’t move with the press of the key. I’ve attached a screenshot of what it looks like when i press the up key.
Ah, my bad. The original events used the marker to move the player. I though it’d be something different. To fix, modify the event that creates the marker so it gets created at “baby_2.CenterX(), baby_2.CenterY()”