I want the object to move continuously downward even while I'm pressing the upward key in keyboard. Eventually causing the object to drop completely after some moment.
character = pygame.image.load('pngfile') character_size = character.get_rect().size to_x = 0 to_y = 0 clock = pygame.time.Clock() character_speed = 0.05 velocity_y = 0.1 #eventloop running = True while running: dt = clock.tick(60) for event in pygame.event.get(): if event.type == pygame.QUIT: running = False character.move_ip(0, velocity_y * dt)
so on and so on. I skipped the unnecessary parts to keep it short. Whenever I type the last line,
move_ip doesn't become a method. It works find when I changed the object to
pygame.Rect() but I don't know why this one isn't working. I got the keyboard control right but I just couldn't make the object to move constantly. Any help will be greatly appreciated.