Some changes on movement system
This commit is contained in:
@@ -20,6 +20,8 @@ ballpos_y = 10
|
|||||||
|
|
||||||
class GameObject():
|
class GameObject():
|
||||||
__name = str()
|
__name = str()
|
||||||
|
__last_pos_x = int()
|
||||||
|
__last_pos_y = int()
|
||||||
__pos_x = int()
|
__pos_x = int()
|
||||||
__pos_y = int()
|
__pos_y = int()
|
||||||
__color = (0,0,0)
|
__color = (0,0,0)
|
||||||
@@ -36,6 +38,8 @@ class GameObject():
|
|||||||
self.__name = name
|
self.__name = name
|
||||||
self.__pos_x = posx_init
|
self.__pos_x = posx_init
|
||||||
self.__pos_y = posy_init
|
self.__pos_y = posy_init
|
||||||
|
self.__inital_pos_x = posx_init
|
||||||
|
self.__initial_pos_y = posx_init
|
||||||
self.__movespeed = move_speed
|
self.__movespeed = move_speed
|
||||||
#self.__rectobjekt = rect
|
#self.__rectobjekt = rect
|
||||||
|
|
||||||
@@ -81,7 +85,7 @@ class GameObject():
|
|||||||
def draw(self):
|
def draw(self):
|
||||||
#font = pygame.font.SysFont(None, 70)
|
#font = pygame.font.SysFont(None, 70)
|
||||||
#text = font.render("TEST", True, (0,0,0) )
|
#text = font.render("TEST", True, (0,0,0) )
|
||||||
if(self.__hide == False):
|
if(self.__hide == False): # Update this --redraw each 10 pixels or self_size
|
||||||
self.__rectobjekt = pygame.draw.rect(self.__surface, self.__color, [self.__pos_x, self.__pos_y,self.__size_rect["x"],self.__size_rect["y"]])
|
self.__rectobjekt = pygame.draw.rect(self.__surface, self.__color, [self.__pos_x, self.__pos_y,self.__size_rect["x"],self.__size_rect["y"]])
|
||||||
|
|
||||||
def get_rect(self):
|
def get_rect(self):
|
||||||
@@ -137,7 +141,7 @@ background = pygame.surface.Surface((640,480))
|
|||||||
|
|
||||||
x = 3600
|
x = 3600
|
||||||
invert = False
|
invert = False
|
||||||
spawned_entities = spawn_entities(50) #Spawnt eine definierte Anzahl an GameObjekten
|
spawned_entities = spawn_entities(10) #Spawnt eine definierte Anzahl an GameObjekten
|
||||||
#Fenster-Hauptschleife
|
#Fenster-Hauptschleife
|
||||||
while active == True:
|
while active == True:
|
||||||
MAINSCREEN.fill((255,255,255))
|
MAINSCREEN.fill((255,255,255))
|
||||||
@@ -175,7 +179,7 @@ while active == True:
|
|||||||
|
|
||||||
if(x == 0):
|
if(x == 0):
|
||||||
for y in spawned_entities:
|
for y in spawned_entities:
|
||||||
y.remove()
|
y.hide()
|
||||||
pass
|
pass
|
||||||
x -= 1
|
x -= 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user