add information

This commit is contained in:
anna
2026-06-17 15:25:34 +08:00
parent a59186e952
commit 54c2cf9ee6
3 changed files with 7 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

10
main.py
View File

@@ -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()