generated from mwc/project_game
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!
This commit is contained in:
19
starfall.py
Normal file
19
starfall.py
Normal file
@@ -0,0 +1,19 @@
|
||||
class Star:
|
||||
character = '*'
|
||||
|
||||
def __init__(self, position):
|
||||
self.position = position
|
||||
|
||||
def play_turn(self, game):
|
||||
width, height = game.board_size
|
||||
if game.turn_number % 2 == 0:
|
||||
x, y = self.position
|
||||
if y == height - 1:
|
||||
game.remove_agent(self)
|
||||
else:
|
||||
person = game.get_agent_by_name('Person')
|
||||
new_position = (x, y + 1)
|
||||
if new_position == person.position:
|
||||
game.end()
|
||||
else:
|
||||
self.position = new_position
|
||||
Reference in New Issue
Block a user