Need help with ramping car game

2 replies [Last post]
Matt Barton
Matt Barton's picture
Joined: 01/16/2006

I'm attaching my Gamemaker code here in case somebody is able and willing to help with this...As you can see, I seem to be "close" to a workable solution, but am still failing hard. I've tried lots of variations, but this is the closest I've been able to get to making it work properly.

The problem seems to be in discovering how much or how little to change the image rotation of the warthog at various points. I've looked online for help and looked at math equations until my head ached, but I just can't get it.

Anyway, I'm hoping somebody can look at this and point me in the right direction. And no, I'm not interested in converting this to Unity or whatever. I know it is possible to do this in GM because I have seen people do it.

Basically, this is what I'm after:

I tried copying his code and adapting it, but failed miserably.

base2.zip825.83 KB
Matt Barton
Matt Barton's picture
Joined: 01/16/2006
Yeah, it's a lot more

Yeah, it's a lot more complicated than that. Gamemaker will let me choose any angle I want for the sprite. If I try to suddenly shift to 45, though, it looks like crap. Obviously you need to change the angle gradually, increasing it as the car gets further up the ramp.

The hard part for me is how to bring it back down to 0. I was checking to see if a wheel was off the ground, then lowering or reducing the angle until it wasn't. That approach resulted in either a "seesaw" effect or it comes down too slowly and looks dumb.

There must be a way to figure out exactly how much to change the angle based on the steepness of the ramp and speed of the vehicle. I just don't know what it is or how to calculate it.

Joined: 01/21/2009
I cant help but would suggest

I cant help but would suggest looking at one of million HALO warthog games. I know i saw lots back about 2 years ago.. and many had ramps. Also I suggest posting here.

I know , no answer.. it sucks.. I know I played several games with the HALO warthog going up and down ramps.. I seem to remember it was collision related.. If player was touching ramp it switched it to a different sprite.. of course all his ramps where the same.. so he just had 2 different sprites. one going up a ramp and one going down for the ramps.. maybe that wont work for you.

tutorial you have is good, it just super complicated. But depending on what you are doing maybe it has to be.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Images can be added to this post.
  • You may quote other posts using [quote] tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.