Some chagens on GameOjects class
Code cleanup Some stability tests
This commit is contained in:
@@ -67,27 +67,23 @@ menu.mainloop(MAINSCREEN)
|
||||
def spawn_entities(x:int, list_of_objects:list):
|
||||
count = 0
|
||||
for y in range(x):
|
||||
rect_size = 60
|
||||
rect_size = 80
|
||||
Entity = Block("Entitiy-"+str(count), MAINSCREEN, MAINSCREEN_SIZE, rand.randint(1,MAINSCREEN_SIZE[0]), rand.randint(1,MAINSCREEN_SIZE[1]), rand.randint(1,15), is_rect=True, rect_size=(rect_size,rect_size))
|
||||
Entity.get_name(True)
|
||||
list_of_objects.append(Entity)
|
||||
count += 1
|
||||
|
||||
player = Player("Player", MAINSCREEN, MAINSCREEN_SIZE, 10, 10, 10, is_player=False, is_rect=True, rect_size=(50,50))
|
||||
|
||||
testobj = GameObject("TESTOBJEKT", MAINSCREEN, MAINSCREEN_SIZE, 0,0,0,image="data/models/testmodel.bmp")
|
||||
test = pygame.image.load("data/models/testmodel.bmp").convert()
|
||||
player = Player("Player", MAINSCREEN, MAINSCREEN_SIZE, 10, 10, 10, is_player=False, is_rect=True, rect_size=(80,80))
|
||||
|
||||
goo = GOIMAGE("TESTOBJEKT", MAINSCREEN, MAINSCREEN_SIZE, 0,0,0,image="data/models/testmodel.bmp")
|
||||
|
||||
background = pygame.surface.Surface((640,480))
|
||||
|
||||
|
||||
x = 3600
|
||||
invert = False
|
||||
colided_objects = list()
|
||||
spawned_entities = list()
|
||||
spawn_entities(30, spawned_entities)
|
||||
spawn_entities(150, spawned_entities)
|
||||
count_hidden_entities = 0
|
||||
count_spawend_enities = len(spawned_entities)
|
||||
print("Es wurden " + str(count_spawend_enities)+ " Objekte gespawnt")
|
||||
@@ -105,21 +101,18 @@ while active == True:
|
||||
active = False
|
||||
elif (event.type == pygame.KEYDOWN):
|
||||
if (event.key == pygame.K_UP):
|
||||
print("Keydown")
|
||||
#print("Keydown")
|
||||
player.change_direction("up")
|
||||
elif (event.key == pygame.K_DOWN):
|
||||
print("Keydown")
|
||||
#print("Keydown")
|
||||
player.change_direction("down")
|
||||
elif (event.key == pygame.K_RIGHT):
|
||||
print("Keydown")
|
||||
#print("Keydown")
|
||||
player.change_direction("right")
|
||||
elif (event.key == pygame.K_LEFT):
|
||||
print("Keydown")
|
||||
#print("Keydown")
|
||||
player.change_direction("left")
|
||||
if(x > 0):
|
||||
testx += 1
|
||||
if(testx >= MAINSCREEN_SIZE[0]): testx = (0 - test.get_size()[0])
|
||||
MAINSCREEN.blit(test, (testx,testy))
|
||||
|
||||
goo.draw()
|
||||
|
||||
player.draw()
|
||||
|
||||
Reference in New Issue
Block a user