Files
test/game.py
2024-08-25 22:28:22 +02:00

68 lines
1.5 KiB
Python

############################################################
## Implement all Gamemechanics here! ##
############################################################
import GameObject
import animations
from levels import *
import pygame
import logger
import random
import copy
#Leveldefinitions
levels_list.append(first_level("First Level", (500,500), 10, 2))
items = [
GameObject.item_extra_life("Extra-Life", 0, 0, 30, 30, None)
]
enemys_spawned = list()
items_spawned = list()
#Override
def loadlevels():
for level in levels_list:
if(type(level) == "level"):
print("LEVEL")
print(level)
pass
def item_handler(screen:pygame.Surface):
spawn_chance = random.randint(0, 1000)
#print(spawn_chance)
if(spawn_chance == 0):
#print("Spawne item")
spawn_item_random(screen)
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)
def handle_playerinput(players):
for player in players():
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