Files
project_game/starfall_spawner.py
caglazir 0975b52301 I coded the introduction part of my game.
In this milestone I created necessary files such as Starfall, starfall_spawner,
person, and questioner. I used smaple codes from Retro and adjusted them to suit
my purposes. I am proud of the Questioner file. I was intimidated that I would
drop the ball on the dialogue spawn but after frustrating few tries, I manges to make it look
and spawn as I wanted it to. I am now worried about how to make the starfall_spawner
launch and abort as intended (start after answers then pause once player collects 200 points.)
I learned new skills with how to accept input answers. I was reading up on ways to sort the answers
and I learned about strip and upper functions that help remove spaces and lowercase specifications!
2025-12-07 16:43:05 -05:00

17 lines
507 B
Python

from random import randint
from starfall import Star
class StarfallSpawner:
display = False
def play_turn(self, game):
if not game.state.get("begin"):
return
width, height = game.board_size
game.state['score'] += 1
if self.should_spawn_star(game.turn_number):
star = Star((randint(0, width - 1), 0))
game.add_agent(star)
def should_spawn_star(self, turn_number):
return randint(0, 1000) < turn_number