Files
pacmanpythondhbw/Game_Package/MoveAble.py
T
2024-10-29 17:18:30 +01:00

25 lines
688 B
Python

from Entity import Entity
from Vec import Vec
class MoveAble(Entity):
def __init__(self, start_position: Vec, start_size: Vec, speed):
super().__init__(start_position, start_size)
self.velocity = Vec(0, 0)
self.speed = speed
def move(self):
self.position.add(self.velocity)
def check_bounds_move(self, screen_width, screen_height):
if self.position.x < 0:
self.position.x = screen_width
elif self.position.x > screen_width:
self.position.x = 0
if self.position.y < 0:
self.position.y = screen_height
elif self.position.y > screen_height:
self.position.y = 0