[Solved] Issue with item placements between editor and preview

  1. Hello. I’m new to this platform, and to game development in general. I am trying to make a mask of a map so that enemies can use the Pathfinding extension to navigate to the player through the map. For testing purposes, I have bound a key to scroll through the different maps, there are seven in total, but only six have masks. The masks for the corresponding map then show up on top of the map.

  2. What I’m expecting is for the mask to be properly aligned with the map walls.

  3. Instead, though, the mask is misaligned from the map, for all of them except whichever one it starts on when I open the preview. Please note they were all perfectly aligned in the editor.

Here’s the relevant screenshots. Left is how it appears in the editor, right is how it appears in the preview.

Can you provide a screenshot of the events used for scrolling?

Thanks for the timely reply.
The only thing that moves the camera is the extension SmoothCamera, bound the character you see in the screenshots, which does not have any event in the script. I’ve noticed the same issue with it deactivated too. Elsewise, I’m not sure what you mean by scrolling.

Scrolling as in the camera movement. Do you use any layers? Can you share the events that move objects?

The masks are all on their own layer, for convenience purposes, but they are all transferred to the base layer when the game starts, as you can see at the bottom of the left screenshot.

The only other thing that references the map or the masks at all is the hotkey for switching maps, which won’t be present in the final game. (middle screenshot)

And this code for loading the correct mask for each map. (right screenshot)

Hope these help.

Does the shift of mask position stay the same throughout the game?

Is each mask an animation of ManovuereGood? Are the origin points of each animation the same?

  1. Yes, the masks move with the camera like everything else on the base layer, just misaligned from the map walls.
  2. Yes, the masks are created entirely of copies of the sprite ManovuereGood, arranged in the editor to follow the walls of the different maps. Each map has a different animation in the ManovuereGood sprite to differentiate them, as suggested by the rightmost screenshot of the second batch of images.

And how have you confirmed each mask animation fits the map it’s for?

And why don’t you make the walls Pathfinding Obstacles, instead of using another object on an extra layer?

  1. Yes
  2. Because the map is a single sprite, and the Pathfinding extension can only guide objects around obstacles, not through them.
  1. This is not a yes/no question. How have you confirmed each mask fits it’s map in the editor?

  2. Isn’t ManovuereGood the pathfinding obstacle? And isn’t that just one sprite too? In which case I don’t understand how you are making, or going to make, this work.

  3. Why must each map be a whole sprite? Normal practice is to have the objects on the scene.

  4. And how large is this sprite?

  1. By placing multiple copies of the ManovuereGood sprite to cover the map in the editor, so that they form a copy, so to say, of the map walls. Look at the first image I sent.
  2. Not quite. Its many copies of the same sprite, arranged in a pattern similar to the map walls.
  3. Maybe, but I wanted to make the map one sprite to make swapping between the different maps easier. As some of them are made of many individual small parts, splitting it into individual objects would be fairly messy.
  4. The map sprite on scene is 3212 by 2670.
  1. So ManovuereGood is a green block?

  2. So what are the animations for ManovuereGood?

  3. You can achieve something similare with layers, or by having each ‘map’ at a different area of the scene.

  4. You may want to read this GDevelop wiki entry on image sizes.

But all this doesn’t solve your issue, and I’m not any closer to having an idea of what’s going wrong.

I can have a look at your project if you’d comfortable with that. Zip it up and put it on a file share (GoogleDrive, OneDrive, DropBox etc) and drop me DM with the link.

Thank you so much for your help.

  1. ManouvereGood has different coloured blocks for each of the maps. That is how I distinguish them. The one for that map is green.
  2. The different coloured blocks for each of the different maps.
  3. I actually tried making each of the masks on a different layer. Same issue, and I also had to deal with the camera scroll. If I don’t find a way to solve it I might try that other idea though.
  4. Thanks. Will do.

Might share it.

I couldn’t get the misalignment thing to stop, so I went with your idea and separated them into different areas of the scene. It works fine now. Many thanks.

1 Like