add dinos

This commit is contained in:
Anna
2026-06-11 11:01:01 +08:00
parent 99fcf2685f
commit c03de224a9
2 changed files with 19 additions and 0 deletions

19
main.py
View File

@@ -14,10 +14,29 @@ sword = Actor("sword")
dinosuars = []
corpses = []
spawn_interval = 2.0
min_spawn_interval = 0.2
spawn_timer = 0
game_time = 0
def draw():
screen.fill((100,220,100))
apple.draw()
def spawn_dinosaur():
dino = Actor("dino")
side = random.randint(0,3)
if side == 0:
dino_x = random.randint(0.WIDTH)
dino_y = -50
elif side == 1:
dino_x = random.randint(0,WIDTH)
dino_y = HEIGHT + 50
elif side == 2:
dino_x = WIDTH + 50
dino_y = random.randint(0,HEIGHT)
dinosuars.append(dino)
pgzrun.go()