Some cleanup

This commit is contained in:
Christian
2024-08-24 12:03:24 +02:00
parent 31a695f099
commit 923f476303
3 changed files with 44 additions and 36 deletions

19
game.py
View File

@@ -18,6 +18,7 @@ items = [
GameObject.item_extra_life("Extra-Life", 0, 0, 30, 30, None)
]
enemys_spawned = list()
items_spawned = list()
#Override
@@ -30,7 +31,7 @@ def loadlevels():
def item_handler(screen:pygame.Surface):
spawn_chance = random.randint(0, 10)
spawn_chance = random.randint(0, 1000)
print(spawn_chance)
if(spawn_chance == 0):
#print("Spawne item")
@@ -39,13 +40,25 @@ def item_handler(screen:pygame.Surface):
for item in items_spawned:
item:GameObject.Item
print(item)
if(item.pos_y >= screen.get_size()[1]):
items_spawned.remove(item)
item.move(0, item.speed)
item.render(screen)
pass
def spawn_item_random(screen:pygame.Surface):
items_spawned.append(copy.deepcopy(items[0]))
print("Spawn")
pass
def spawn_enemys(type:object, count:int):
for i in range(count):
pass
pass
def run(screen:pygame.Surface):
screen = screen
item_handler(screen)
pass