Car Game. How to change angle of car to follow slope?

I would like to create a car racing game where the car always faces to the right (so you see a side on view) and moves over land/platforms. What I can not seem to figure out is the movement combination. I can create the character as a platform char so it can jump and move etc, however the char is always horizontal and does not change angle with the slope of the platforms. I have tried changing the collision points on both the char and the platform. I have added physics but that doesn’t seem to do it. I am sure the answer is simple but it is alluding me :confused: :confused: :confused: Any ideas how I could do this?

I tried to make a clone of hill climb racing last year(never completed it) but face the same problem amd failed to do so …so i will also like to know how to do it :smiley:

Not tested, but you could maybe create an invisible “bumper” object that you position at a point right at the front of the car to detect the slope. If this bumper object is in collision with the ground object then you apply an anti-clockwise rotation to the car object. You will have to shift the centre of the car object to near the back wheel so that the rotation doesn’t push the back end into the ground.

This will only work going up a slope, so you’ll need another invisible object positioned below the front of the car to rotate it clockwise when it isn’t in collision with the ground object so that it faces down slopes.

Ooo thats another way to do it. I was trying something similar today by making a dozen different slopes out of a bar and using a block to match the slope :slight_smile: Still a little jerky in the movement but it has possibilities.

For a car game I would use pure physics, platformer behavior has fixed angles and is not “real” physics at all, so you end trying to simulate physics bahaviors when you have this already out of the box in another extension :slight_smile:

There was a post some years ago from victor with a nice car example, I can’t find it so I made a new one:
Car.zip (40.4 KB)

Thanks :*

I’m at the same point but at mine it is only collect a idea.:wink:

Can’t open this Car.zip in gdevelop 5 because of extension .gdg.:unamused:
Think it’s for an older version.
Does anyone can make a new example file?
A video would also be good.:wink:

Edit:
Ok, .gdg is an old version (have installed gdevelop 4 and saved as .json for gdevelop 5).