Hi all,
I’m trying to use keyboard as an alternative to the mouse to move my keyboard so it moved smoothly. Well, not only smooth, but also comparably fast to a mouse movement
At the moment, my Pong game moved the mouse in a “jumpy” manner, as if it’s lagging. here’s my keyboard code
self.accept('w', self.moveSecondBatUp)
self.accept('w-up', self.moveSecondBatUp)
self.accept('w-down',self.moveSecondBatUp)
self.accept('s', self.moveSecondBatDown)
self.accept('s-up', self.moveSecondBatDown)
self.accept('s-down', self.moveSecondBatDown)
and here’s my moveSecondBatUp code
def moveSecondBatUp(self):
z = self.bat2.getZ() + 2
maxZ = self.height - 1 - self.batSize
if (z > maxZ): z = maxZ
self.bat2.setZ(z)
def moveSecondBatDown(self):
z = self.bat2.getZ() - 2
minZ = 1.0;
if (z < minZ): z = minZ
self.bat2.setZ(z)
Anyone have any suggestion?
Thanks in advance,
Suwandy