Move with arrow keys (without skipping)

edited January 2018 in Python Mode

I would like to move an image in my game with arrow keys without the initial skip at the start. When I press a key, it moves once to the direction of the button, pauses, then continues moving repeatedly. I would like to get rid of that pause after the first move, but have not found any solutions yet.

class Player:
    def __init__(self, ship, name, speed, health, damage):
        self.ship = ship = name = health
        self.damage = damage
        self.speed = speed
        self.bounty = 100
        self.positionX = 270
        self.positionY = 800

    def play(self):
        image(self.ship, self.positionX, self.positionY)

    def move_left(self):
        self.positionX -= self.speed

    def move_right(self):
        self.positionX += self.speed

class Enemy:
    def __init__(self, type, health, damage, speed):
        self.type = type = health
        self.damage = damage
        self.speed = speed

def keyPressed():
    global player
    if key == CODED:
        if keyCode == LEFT:
        elif keyCode == RIGHT:
Sign In or Register to comment.