sep-pm-platformer/project/sprite/DynamicSprite.py

26 lines
600 B
Python
Raw Normal View History

2023-03-25 15:41:32 +01:00
import pygame
import sys
from sprite.Sprite import Sprite
from sprite.Spritesheet import Spritesheet
from sprite.StaticSprite import StaticSprite
sys.path.append('./sprite')
class DynamicSprite(StaticSprite):
def __init__(self, spritesheet: Spritesheet):
super().__init__(spritesheet)
self.motion = (0, 0)
self.deceleration_horizontal = 0
self.gravity = 0
def tick(self, dt: float):
super().tick(dt)
self.motion = (
self.motion[0] - self.deceleration_horizontal * dt,
self.motion[1] + self.gravity * dt
)