I use the cont.activate() method to play sounds and animations. It doesn’t really work though. The animation won’t stop playing and the sound can’t go faster than the .wav’s length. What is a good way to do those two things and have them work correctly?
And while I am at it, how would I make this (code below) do diagonal movement. I was hoping there is a way other than creating 4 more ifs for each key combo.
if onGround.positive:
if wKey:
player.setLinearVelocity((0, speed, 0), True)
cont.activate(animation)
elif sKey:
player.setLinearVelocity((0, -speed, 0), True)
cont.activate(animation)
if dKey:
player.setLinearVelocity((speed, 0, 0), True)
cont.activate(animation)
elif aKey:
player.setLinearVelocity((-speed, 0, 0), True)
cont.activate(animation)
Thanks