[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] move problems



move() hates me. This is my code (inside the main game loop):

-----------------

if key[K_RIGHT]:
        spaceship.speed=(spaceship.speed[0]+10, spaceship.speed[1])
        print("K_RIGHT") #debug
    if key[K_RIGHT]:
        spaceship.speed=(spaceship.speed[0]-10, spaceship.speed[1])
        print("K_LEFT") #debug
    #/keys
   
    spaceship.rect= spaceship.rect.move(spaceship.speed)
   
    ##yatta yatta... more code here...

    screen.fill(black)
    gameObjects.draw(screen)
    pygame.display.flip()


---------------
the debug code

print("K_RIGHT")

and

print("K_LEFT")

shows that pygame is getting the message that I'm pressing the arrow keys, it just doesn't move the player's ship.