add information
This commit is contained in:
10
main.py
10
main.py
@@ -6,10 +6,10 @@ WIDTH = 800
|
||||
HEIGHT = 600
|
||||
|
||||
APPLE_POS = (WIDTH / 2, HEIGHT / 2)
|
||||
DINO_SPEED = 80
|
||||
DINO_SPEED = 120
|
||||
START_SPAWN_INTERVAL = 2.0
|
||||
MIN_SPAWN_INTERVAL = 0.2
|
||||
SPAWN_ACCELERATION = 0.005
|
||||
SPAWN_ACCELERATION = 0.3
|
||||
CORPSE_LIFETIME = 2.0
|
||||
APPLE_HIT_RADIUS = 25
|
||||
|
||||
@@ -32,7 +32,9 @@ def on_mouse_move(pos, rel, buttons):
|
||||
|
||||
def spawn_dinosaurs():
|
||||
"""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)
|
||||
if side == 0: # up
|
||||
@@ -49,6 +51,7 @@ def spawn_dinosaurs():
|
||||
dino.y = random.randint(0, HEIGHT)
|
||||
dinosaurs.append(dino)
|
||||
|
||||
|
||||
def update(dt):
|
||||
global spawn_timer, spawn_interval, game_time, score, missed_apples
|
||||
game_time += dt
|
||||
@@ -86,6 +89,7 @@ def update(dt):
|
||||
if game_time - corpse["die_time"] >= CORPSE_LIFETIME:
|
||||
corpses.remove(corpse)
|
||||
|
||||
|
||||
def draw():
|
||||
screen.fill((100, 200, 100))
|
||||
apple.draw()
|
||||
|
||||
Reference in New Issue
Block a user