16 lines
491 B
Python
16 lines
491 B
Python
|
import pygame
|
||
|
import numpy as np
|
||
|
|
||
|
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)
|