I was just adding acceleration and the inverse to Roaming Ralph, instead of being an on/off case for his forward input, and I thought the sin curve would be tight and responsive. Then, whenever the button is released, he needs to decelarate, and I thought a constant decrease would be more suitable. Here’s the code:
def move(self, task):
# If a key is pressed, move Ralph in that direction
if (self.keyMap["forward"] != 0):
if self.counter < 90:
self.counter += 6
self.accel = 25 * sin(self.counter * pi/180)
self.ralph.setY(self.ralph, -self.accel * globalClock.getDt())
else:
if self.counter > 0:
self.counter -= 6
self.deccel = 25 * self.counter/180
self.ralph.setY(self.ralph, -self.deccel * globalClock.getDt())
if (self.keyMap["left"] != 0):
self.ralph.setH(self.ralph.getH() + 300 * globalClock.getDt())
if (self.keyMap["right"] != 0):
self.ralph.setH(self.ralph.getH() - 300 * globalClock.getDt())
The feel is nice, even if it was a small change. What I’m asking here is suggestions for other types of curves.