[SOLVED] Object angle on slopes V2

Hey there,
I’m sorry to bother you all…but i guess that i probably need help here.
Here 2 pics



I’m creating some critters to fill the world of my game.
I’m trying to figure out how to make the mouse in the picture
to rotate automatically on my slope.
Problem is that i can’t check the angles because are Tiled slopes.I already have the AI which will make things move around but the object’s angles are giving me problems.

I was thinking to use some collision point in the mask to check the collision, so if is not it will rotate the object…but i suck at math…so i wonder if someone have a better method to share.
Thx in advance.

more infos:
-the mouse have platformer behaviour.
-untouched collisions box around the mouse silhouette
-origin is bottom middle
-tiles are 16x16px

  • slopes angles are random

From what i experienced; tiled sprites are no good for slopes. They get wonky with the positioning.
I use a hidden normal sprite for the platform and then another layer above that for visual graphics with no platform behaviour. If there’s a solution with tiled sprites i’d love to learn too.

I’ve that issue fixed it’s just a matter to poisition collisions properly in Tiled.

Also if u have not, be sure to position your origin points at middle bottom

i fixed it. here the solution.
Dunno how demanding is in terms of performances but it works

it can be used even to prevent enemies from falling (recognize platforms) automatically

1 Like

Hello
how did you add collision in tiled and got it to work in gdevelop?

The wiki tutorial works fine.
But here is my process:

-Create a terrain tileset in Tiled.
-Define in Tiled the collisions (there is an option for that).
For slopes u must be veeeery precise at assigning points.
-after htat u just need to export as json and follow the wiki.

just remember that u gonna need 2 object in Gdevelop for each map.
The tiled object and the Tiledmask.

It can be very confusing at start…i know…but it works.

Thank you very much for the help i am going to try it.

Just a bit of tuning needed but… it works

1 Like

Okay so i added the collision but i can’t get it to work
i added a tilemapmask do i need to add some event too?

add platform behaviour to tiled collision mask.
and if you have a player object add the platformer behaviour with controls.
your player object should collide with the tiled mask. be sure to double check the collision for each object.
They must be squared collision box

I have top down character and map

Then bind the top down behaviour to your character.
It should work the same as long you see collisions of your tiled map mask.
try to check the debug option in your tiled map mask it should show collisions


it shows like this in the editor

Collisions mask seems to work, but seems a bit overpopulated.
Anyway i suggest you to open a new thread posting your screenshots for better assistance

Okay thank you for your help!!!

Improved version and performance…you actually dont need 2 raycasts to make it work…1 is enough.

There is no issue on platformer behaviour or in flip actions.
edit: i removed the platformer behaviour from the mouse and assigned it to a proxy box sprite cos the box must not rotate…cos…collisions

1 Like