26 lines
600 B
Python
26 lines
600 B
Python
|
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
|
||
|
)
|