generated from mwc/project_game
In this submission, I worked on my question spawns
This was honestly a difficult submission. There were moments when I wanted to just quit. I tried so hard to figure out why certain things wouldnt happen (such as my starfall spawn not stopping once the milestone score is reached). It took me soooo many trials and errors and bunch of researching to figure out how to troubleshoot. I feel like this was an enormous learning experience and I am overall proud of my game so far. However there is a lot of clean up to do. My "lives" mechanic is still not in place. What I have in place is temporary until I can figure out the play/pause mechanic with the point system. I also currently have NO IDEA how to remove the text from the screen. During the question phase the texts overlap. Might have to keep researching that or I might send a message to the server. Overall I feel like I learned how to THINK for creating games and placing a bunch of conditional statements that flow one after the other. I am loving the productive struggle!!
This commit is contained in:
18
.history/starfall_spawner_20251212222744.py
Normal file
18
.history/starfall_spawner_20251212222744.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from random import randint
|
||||
from starfall import Star
|
||||
|
||||
class StarfallSpawner:
|
||||
display = False
|
||||
|
||||
def play_turn(self, game):
|
||||
if not game.state.get("begin", True):
|
||||
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
|
||||
Reference in New Issue
Block a user