py_yugi_clone/scripts/entities.py
2024-07-12 16:56:47 +02:00

17 lines
536 B
Python

import pygame
import numpy as np
from scripts.utils import to_isometric_pixel
class Entity:
def __init__(self, game, e_type, pos, size):
self.game = game
self.type = e_type
self.pos = np.array(pos)
self.size = size
self.velocity = np.array([0,0], dtype=np.float32)
def update(self, movement = np.array([0,0])):
frame_movement = self.velocity + movement
self.pos += frame_movement
def render(self, surface):
surface.blit(self.game.assets[self.type], self.pos)