add information
This commit is contained in:
BIN
images/dead.png
BIN
images/dead.png
Binary file not shown.
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
images/dead8.png
BIN
images/dead8.png
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
10
main.py
10
main.py
@@ -6,10 +6,10 @@ WIDTH = 800
|
|||||||
HEIGHT = 600
|
HEIGHT = 600
|
||||||
|
|
||||||
APPLE_POS = (WIDTH / 2, HEIGHT / 2)
|
APPLE_POS = (WIDTH / 2, HEIGHT / 2)
|
||||||
DINO_SPEED = 80
|
DINO_SPEED = 120
|
||||||
START_SPAWN_INTERVAL = 2.0
|
START_SPAWN_INTERVAL = 2.0
|
||||||
MIN_SPAWN_INTERVAL = 0.2
|
MIN_SPAWN_INTERVAL = 0.2
|
||||||
SPAWN_ACCELERATION = 0.005
|
SPAWN_ACCELERATION = 0.3
|
||||||
CORPSE_LIFETIME = 2.0
|
CORPSE_LIFETIME = 2.0
|
||||||
APPLE_HIT_RADIUS = 25
|
APPLE_HIT_RADIUS = 25
|
||||||
|
|
||||||
@@ -32,7 +32,9 @@ def on_mouse_move(pos, rel, buttons):
|
|||||||
|
|
||||||
def spawn_dinosaurs():
|
def spawn_dinosaurs():
|
||||||
"""Create a dinosaur just outside one edge of the screen."""
|
"""Create a dinosaur just outside one edge of the screen."""
|
||||||
dino = Actor("dino")
|
dino_images = ("dino", "dino2")
|
||||||
|
random_dino = random.choice(dino_images)
|
||||||
|
dino = Actor(random_dino)
|
||||||
|
|
||||||
side = random.randint(0, 3)
|
side = random.randint(0, 3)
|
||||||
if side == 0: # up
|
if side == 0: # up
|
||||||
@@ -49,6 +51,7 @@ def spawn_dinosaurs():
|
|||||||
dino.y = random.randint(0, HEIGHT)
|
dino.y = random.randint(0, HEIGHT)
|
||||||
dinosaurs.append(dino)
|
dinosaurs.append(dino)
|
||||||
|
|
||||||
|
|
||||||
def update(dt):
|
def update(dt):
|
||||||
global spawn_timer, spawn_interval, game_time, score, missed_apples
|
global spawn_timer, spawn_interval, game_time, score, missed_apples
|
||||||
game_time += dt
|
game_time += dt
|
||||||
@@ -86,6 +89,7 @@ def update(dt):
|
|||||||
if game_time - corpse["die_time"] >= CORPSE_LIFETIME:
|
if game_time - corpse["die_time"] >= CORPSE_LIFETIME:
|
||||||
corpses.remove(corpse)
|
corpses.remove(corpse)
|
||||||
|
|
||||||
|
|
||||||
def draw():
|
def draw():
|
||||||
screen.fill((100, 200, 100))
|
screen.fill((100, 200, 100))
|
||||||
apple.draw()
|
apple.draw()
|
||||||
|
|||||||
Reference in New Issue
Block a user