Changed some classes
This commit is contained in:
@@ -1,22 +1,34 @@
|
||||
import pygame
|
||||
|
||||
class GameObject(object):
|
||||
def __init__(self, name, pos_x, pos_y, image=None,) -> None:
|
||||
objects = list()
|
||||
def __init__(self, name, pos_x, pos_y, width, height, image=None) -> None:
|
||||
self.name = name
|
||||
self.pos_x = pos_x
|
||||
self.pos_y = pos_y
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.image = image
|
||||
self.objects.append(self)
|
||||
pass
|
||||
|
||||
def get_objectinfo(self):
|
||||
print(F"Gameobject-Info: \n",
|
||||
F"Name: {self.name}\n",
|
||||
F"Position x: {self.pos_x} y: {self.pos_y}\n",
|
||||
F"Size = width: {self.width} height: {self.height}"
|
||||
)
|
||||
|
||||
def render(self, screen:pygame.Surface):
|
||||
if(self.image is not None):
|
||||
screen.blit(self.image, (self.pos_x, self.pos_y))
|
||||
screen.blit(self.image, (self.pos_x, self.pos_y, ))
|
||||
else:
|
||||
print("Kein Image hinterlegt!")
|
||||
|
||||
|
||||
|
||||
def setpos(self, pos_x, pos_y):
|
||||
self.pos_x = pos_x
|
||||
self.pos_y = pos_y
|
||||
|
||||
def setsize(self, width, height):
|
||||
self.width = width
|
||||
self.height = height
|
||||
Reference in New Issue
Block a user