[Python] Floating animation slowly moves object upwards Pygame

Discussão em 'Python' iniciado por Stack, Novembro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm writing a script for an object that's supposed to hover in place, but instead, it slowly moves upwards. Heres the code:

    (Init function)

    self.vy = 0
    self.dy = 0.1


    (Update function)

    self.vy += self.dy
    if self.vy > 1 or self.vy < -1:
    self.dy *= -1
    self.imgRect.centery += self.vy

    Continue reading...

Compartilhe esta Página