I’m working on an isometric game, which means many of my objects, like floor, are not rectangular, but the full object area always is, and as a results, the floor objects will always overlap.
I’m trying to play different footsteps sounds depending on the floor type using Point Inside Object.
The problem is that when two objects overlap, the sound will stop, because the condition “player is inside object” is no longer valid, since the player is in fact in two different floor objects at the same time. See the screenshot below, where the Grass object is overlapping the Ground object:
Is there any way to avoid the the object overlap in an isometric set up?
Or play the correct sound depending on the floor type even if it’s overlapping with another type?
You could use the pick nearest object as the last condition or maybe save the last value or current sound and somehow only change the sound if it’s not one of the tiles. I’m not sure how to implement the 2nd one. I’d have to try it.
If the collision box matches the visual shape, it would only trigger when inside. There could be a gap between tiles but you would only change the sound when there was a tile anyways.
You could check multiple points and somehow make a decision based on both. Again, I’m not sure how. I’m a but distracted at the moment.
You need to edit your collision mask to fit the visible tile instead of the whole rectangle. Also the Isometric example has a simple setup for using sound on one specific type of tile which would be easy to modify for multiple tile sounds.
I was had tried the collision instead of “Point inside object” but I couldn’t make it work before, but now I tired again and it did work! So, thanks for suggesting it.
Though now I have a new issue
On the border of two tiles, the character’s collision mask will cover two tiles at once, so two different sounds will play at the same time.
I saw that I can create multiple collision masks, so I can make the mask smaller for the character, but I don’t see a way of picking which mask should be the one that is used for the collision with a specific object.
You can use a custom mask with point is inside. If the objects no longer overlap then it should only pick 1 object. Either way, you can still use pick nearest object from the players x,y or whatever point ot object.
The collision mask is per animation or animations.
Yeh it’s possible to do but is it practical in your game? For example in my project, I have buildings and decor that the player can move and place as they see fit. I absolutely need the collision mask to match the visibile shape of the object at least, so they are able to drag it. So animation0 collision box is that. But when dropping, because it is isometric, I need the collision box to only be on the base of the item and only as big as how many tiles that item will fit on. Otherwise it may “collide” with another item placed in an adjacent tile and be sent back to its original tile, infuriating the player. So animation1, with the appropriate collision mask, is used briefly in events when an item is dropped.
But… I assume your game is going to have monsters or something attacking the player while the player is walking. So I’m not sure if changing collision masks in different situations is practical in your game.
Edit But anyway the Isometric example uses point inside, and it would be an easy route for you to go. You still need to edit your tile collision mask for the tiles and then create a point inside the feet for the player.
Point inside is a collision event. It is actually much simpler to use point inside in isometric collision detecting, I think, than regular collision events. I don’t always use it though, depending if the events I am using it for will eventually need an inversed point inside event. Because I don’t understand those. Keith can explain them over and over to other people in the forum and they all understand but I just don’t. So for logic that would eventually call for an inversed point inside, I use regular collision events instead, although they can be a bit more involved to set up. So how it would work is your character has a custom point that you gave it.
So for example from this tutorial, you see the land image is a huge rectangle with a collsion mask the size of the visible part, the scythe is a small draggable object which interacts with the land to cut crops - for player convenience in dragging, the collision mask is the original whole size of the image. Then the circle is showing where a custom point was put in the scythe. When this point is inside the land object, it will cut down any crops growing there. But because point inside is a collision event, it only checks to see it the point is inside the collision mask part of the land image.
Also, I still cannot figure out the “Multiple Collision Masks”.
I don’t know when or where I can specify which mask should be used for the collision, I can only say what object, but not which of the collision masks that the object might have. Any tips?
I’m not sure I understand your question about masks. Objects can have 1 mask for all animations or seperater masks for each animation or for each frame. The mask setting and the current animation decide which mask is used.
If you had an animation of someone swinging a bat you could align a mask on each frame to follow the bat. So, it would collide in the right spot. Most of the time that type of accuracy isn’t needed and the same rectangle or loose shape is enough. You usually want the mask to loosely fit the image. When the image is small, nobody will notice the difference between a perfecting fitting mask but the more complex a mask the more it takes to process each one on each frame of the game.
There are times when you need 2 masks or 2 objects. So, you can use a 2nd hidden object with the same or a different mask but this should be used only when absolutely necessary because again resources.
As for the point is inside. Sometimes inverting a condition doesn’t work as expected and you need to put the non inverted condition inside a Not condition.
You can use multiple shapes but to my knowledge they are merged into 1 mask. I’m not aware of a way to check them separately. Your best choice might be to use 2 objects. You can use actions or the sticker behavior to keep them in sync. A lot people use separate hitboxes.