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.
What I’m expecting is for the mask to be properly aligned with the map walls.
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.
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.
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)
Yes, the masks move with the camera like everything else on the base layer, just misaligned from the map walls.
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.
This is not a yes/no question. How have you confirmed each mask fits it’s map in the editor?
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.
Why must each map be a whole sprite? Normal practice is to have the objects on the scene.
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.
Not quite. Its many copies of the same sprite, arranged in a pattern similar to the map walls.
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.
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.
ManouvereGood has different coloured blocks for each of the maps. That is how I distinguish them. The one for that map is green.
The different coloured blocks for each of the different maps.
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.
Update:
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.