Bounce Behavior - Get enemy to not bounce on certain solid objects

In my attempt to recreate the original Legend of Zelda for NES in GDevelop, I had an issue with the Keese (bat) enemies. I’m using the Bounce extension behavior to make them bounce off the walls of the room, but since they’re a flying enemy, I want them to be able to fly over certain other solid objects in the room, which the player can’t pass through.

I’m separating the solid objects and the player, so it makes sense that the player can’t pass through them. However, I never separated the Keese enemy from those same solid objects, yet it won’t pass through them (I want it to be like it’s flying over them). I thought I could invert the “Separate Objects” action, but I don’t see an option to do that.

I’m using hidden objects as collision objects on a different layer than the tilemap that I’m using. The collision object for the walls is “SolidCollider” and the one for the blocks in the middle of the room (the one I want the bats to be able to pass through) is “BlockCollider”. I have the bats bouncing off the SolidCollider (walls), but I don’t want them to bounce off the BlockCollider objects. I want them to pass through the BlockCollider ones, but they bounce off them too.

Any ideas why this is happening? I thought all solid object collisions were only handled if you had an event to make it happen, yet in this case the bats are bouncing off the objects I want them to be able to pass through. Thanks in advance for any help!

Can you post the collision events? I’m guessing maybe you have all of your different collision objects in a group or all of enemies. Just a guess. If so, the bats will need their own objects or group to use in the collision condition.

Here are the collision events:

So I tried two things here. First, I was using SolidCollider for the only collision object for all solids and tried setting an instance variable (0=wall, 1=block, 2=water). However, with this code and the instance variables of 1=block for the blocks I want them to fly over, they were still bouncing off them.

Next, I created a separate collision object, BlockCollider, for the blocks to cover the blocks in the tilemap. However, when I use this BlockCollider object instead, the bats still bounce off it even though I never created an event to tell them to do so. I have the SolidCollider as part of a “Hidden Objects” group in a different scene, but the BlockCollider isn’t part of any group and I just created it to try to solve this problem. I hope that’s the information you were looking for.

Are those the only bounce events? I don’t see anything wrong. Are you positive the bats aren’t in a object group of enemies and the object variables for Type are set for all the objects? If not, how about posting a pic of the other bounce events.

Just a tip: The & and isn’t needed in this situation, conditions are all must be true by default unless inside an OR. It doesn’t hurt anything. It’s just extra work. & ANDs are only really useful when inside an OR.

Those are the only bounce events I have in the game so far, on any event sheet. The bats are in a group called DungeonEnemies, but I’m not seeing how that would affect anything since they’re in the group by themselves since I just started playing with adding enemies in dungeons. Now that I changed the block collider to a different object, I figured this would work since it should have no idea that I’m trying to separate that object from the bats.

I just deleted the object group DungeonEnemies and tried it again, and the bats are still bouncing off the BlockCollider objects for some reason. So now, I really don’t know what’s going on. I want the bats to bounce off the SolidCollider objects and objects in the Doors object group, and nothing else. I don’t see what could be preventing that from happening.

I’m also having trouble with the thing you helped me with a few days ago now that I’ve added a new enemy. Now, for reasons I can’t understand, when I added a Stalfos enemy to a different room in the dungeon and hit it with the sword, it is deleting the bats in Room 1, making the item in Room 1 appear, and playing the sound even when I haven’t entered Room 1 at all. Is there a way I can contact you more directly about that issue?

Thanks for the tip about the & and usage. I’ll change that and keep it in mind going forward.

I’d be willing to look at more screenshots or even your project if you’re willing and able to uploaded it somewhere but otherwise, I’d rather keep everything in the forum where more experienced people than me can also help.

If these are the only bounce events then what happens when you disable one or both of them? It would have to be one of them.

Just in case:
Events editor - GDevelop documentation

How would I give you access to my whole project? Or what way would you prefer I upload it? I think that would certainly help. It would be great if I could record the preview of the game and upload it to you to make it easier for you (and others on the forum) to understand exactly what I mean.

I will report back when I open the project up again tomorrow and try disabling one of those events at a time to see what happens. That’s a good idea which I didn’t even think of.

I went ahead and deleted that new enemy I added and decided I’m going to start again, being more careful this time when I add the Stalfos enemy. When I added that new enemy, everything just went haywire for whatever reason. I clearly messed something up, but I’m not sure what and the results I was getting didn’t make any sense. I’ll see what happens when I try again after I sleep on it.

Let me know how you would like me to get my project to you for further analysis.

Keith, I thank you so much for all the help and feedback you’ve given me thus far. It’s people like you which make the GDevelop community so great!!!

You would have to upload the contents of the project folder. There are many sites for that. I post example projects on GitHub. But there are more user-friendly ones like Google drive, Dropbox or OneDrive. You just need to either make the folder public, or share a password.

1 Like

Ok. I’ll look into that for certain. I’m at a point where I’m beginning to think I might need a bit more help than Google searches can provide, and giving access to my project to someone who is far more experienced than me and willing to help will go a long way in my learning process.

I’m not making any promises but sometimes a screenshot or two just isn’t enough to go by and when I can help and have the time, I try to.

1 Like

I will try to add the new enemy to the scene again and see if I have the same problems that I previously described, as well as the ones regarding the bounce behavior. If I have the same results, I will definitely be willing to upload the project files to Google Drive for you to access and look at. I’ll post here again when I have the project files uploaded.

1 Like