Lerp Interval and Locking KeyStrokes?

First I’ll try and explain best I can what I’m trying to achieve. What I’m creating is a grid based game where the main character moves smoothly between each grid on a keystroke. What I want is if the player is still pressing the key after the character has reached the first square I want it to continue into the second.

This is the code I’m using atm

		tester = False
		if(self.keyMap["left"]!=0 and not tester):
			tester = True
				tester = False

What this does is when I press the key the character rockets off to like -30, when in reality I only want it to go to -6.

Another attempt was this


What this one does is on pressing the key the player moves to -6 and stops. Then on each keystroke moves an additional -6. Making it look lurchy.

Any help would be appreciated!


So, you only want it to check for the key state at the end of the interval, as the last thing it does before the interval stops. And only then, if the key is held down, do you want to start a new interval.

So, put the logic that makes this check inside a function, and call that function at the end of the interval by appending a Func(myFunc) inside a sequence, like this:

myInterval1=Sequence(LerpPosInterval(...), Func(myFunc))

Note that you don’t have parens following myFunc: it’s Func(myFunc), not Func(myFunc()).


I think I follow what you are saying. I’m still pretty new to Panda so I’ll try and figure it out! Thanks!

I’m not entirely sure how to implement what your suggesting…

if I got what you’re trying to do (kinda old fallout gameplay) this showcase could provide all you need