A big collision problem

Good evening everyone!
I have a problem with all collisions. I am still trying to develop my top down game. I have created a wall around my level so as not to allow the player to come out, the problem is that I can’t stop the player.
I state that:
Using the physical 2.0 engine, I can block it, but then I can’t create a collision with a laser that kills the player. The player either passes underneath, or hangs at a distance and I can’t eliminate him.
By creating the collision that kills the player, I can’t create collisions with walls.

Now, is there a method for top-down games to create all these collisions easily? Should I use the physical engine, or something else?

Thanks a lot to those who will help me!

Yes, there’s actually an easy way to create collisions for top-down games, but it’s not very obvious for some reason.

This should be all that you need:
In my first condition, I basically check if the player is moving - top-down movement behaviour has that condition so use it instead.
In the sub event, I just check if it’s colliding with the wall, and then use “Separate two objects” action.
That’s basically it. You can try placing the action after the player movement events.

1 Like

It doesn’t work, the character passes over the wall without suffering effects … even setting the laser to eliminate the character, nothing happens …
I attach image, could it be that I did something wrong?

This way it works perfectly!

I should’ve explained better, the two global variables are something I made, not built inside GDevelop. :sweat_smile:
You can use this instead to check if the player is moving or not:

If you put that in the condition, the player will go through moving objects if they are not moving, so be careful about that.

1 Like

Thanks, I hadn’t thought of that!

Hi, and sorry if I disturb you again, but I think I have a problem with collisions again. I created a custom mask, only that Gdevelop does not reveal the collision in that place, but somewhere else … if instead I use the basic mask it works without problems …
I am attaching photos to show you the problem


It’s okay~ I’m not too sure, but some questions anyway:
Where is the collision in-game then, pointing down ward like in collision image?
Can you screenshot that selected light in editor? and show the properties?
Is the image angle rotated? If you rotate the angle, setting Image Point to that bulb (like in my example project) could work.

1 Like
  1. the collision is positioned high, without reason …

  2. We would miss it :slight_smile: here it is!

  3. Yes it is rotated -90 ° … In what way? I don’t think I understand exactly which project you’re referring to

I was referencing the thread about moving your camera actually, specifically this image point thing:

Not sure why it would be positioned higher above the sprite actually…
But can you modify the image size to make it square? Your image size looks vertical, which could be the problem. So for example if your bulb image is 100px x 140px, can you make it 140px x 140px?
Another way you can try is open the image in Photoshop and rotate it 90 degree to the right. GDevelop angle starts at normal 90 degree like the following of the wiki:
So, rotate the images in Photoshop, so hopefully GDevelop will recognize it correctly. Not sure if that’s the issue…

Those are just suggestions, so feel free to tell if it works or doesn’t work.

1 Like

I tried as you say, and the collision occurs just above the character in the photo (even before it happened there)…

The strange thing is that it only happens for these sprites, the rest work correctly … Possible that it is the fault of the last update? I also notice a slower download speed of compiled files…

EDIT: I tried to create another project, and also in that the collision on the light bulb works only if I don’t change the mask…
If you kindly want to try it too, here is the image (can this be a file problem?) :slight_smile:

I edited the image with Gimp and now the collision mask goes without problems…
I did the same thing with the other image, but continues to have the wrong collision mask…
Anyone have a suggestion?