add dinos
This commit is contained in:
BIN
images/sword.png
Normal file
BIN
images/sword.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
19
main.py
19
main.py
@@ -14,10 +14,29 @@ sword = Actor("sword")
|
|||||||
dinosuars = []
|
dinosuars = []
|
||||||
corpses = []
|
corpses = []
|
||||||
|
|
||||||
|
spawn_interval = 2.0
|
||||||
|
min_spawn_interval = 0.2
|
||||||
|
spawn_timer = 0
|
||||||
|
game_time = 0
|
||||||
|
|
||||||
def draw():
|
def draw():
|
||||||
screen.fill((100,220,100))
|
screen.fill((100,220,100))
|
||||||
apple.draw()
|
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()
|
pgzrun.go()
|
||||||
Reference in New Issue
Block a user