Simulating a Bicycle

monkeysaladmonkeysalad Member Posts: 16
edited May 2012 in Working with GS (Mac)
I'm building a bike-racing sidescroller, and I'm curious how other people would go about simulating the way a bike controls.
The way I'm doing it is using a PC_Bike actor with friction of 1 (so he rolls on slopes), and to simulate pedaling I use the self.Accellerate attribute, which I interpolate from 700 to 0 every time the pedal key is pressed (so it cant be spammed). I also turn off accelleration if the bike is in the air.

So I'm pretty happy with the way this works, I have a controllable player that also responds to physics, so I can do jumps etc.
The main problem I'm having is that on steep hills, the player slides backwards because acceleration isnt enough. But If I increase that value any more, the player moves too fast and it stops feeling like a bicycle. One idea I have is to increase self.friction while pedaling.

Does anyone have any other ideas or suggestions of how to build a control scheme that feels like pedaling a bike?

I think this is also generally applicable to any sidescroller where you want the character to respond to physics. I like the feel of self.Accellerate better than using the Move behavior (like the Gamesalad platformer template uses), but its certainly possible theres a better approach to sidescroller controls.

Answers

  • GreenHavenGamesGreenHavenGames Member Posts: 62
    Have you messed with the friction on the slope itself?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Or have a game attribute called game.GoingUpHill that is set to true when you collide with a hill actor. Then in the bike you could have separate acceleration settings for hills.
Sign In or Register to comment.