Files
project_game/questioner.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

31 lines
1.4 KiB
Python

class Questioner:
name = "Questioner"
character = '?'
def __init__(self, board_size):
board_width, board_height = board_size
self.position = (board_width // 2, board_height // 2)
def play_turn(self,game):
person = game.get_agent_by_name('Person')
if person:
personx, persony = person.position
questionerx, questionery = self.position
if personx == questionerx and persony == questionery +1:
prompt = input("Questioner: Are you ready to start the game? [[Y/N]] \n")
if prompt.strip().upper() == "Y":
print("Questioner: Well then, the rules are as follows... \n 1. You have 3 lives. \n 2. For every 200 points you accumulate during Starfall, you receive a question. \n 3. Each wrong answer costs you a life. You must answer 3 questions to escape this terminal. \n")
begin = input("Questioner: Shall we begin? [[Y/N]] \n" )
if begin.strip().upper() == "Y":
print("Questioner: Well then, good luck player! \n")
game.state["begin"] = True
elif prompt.strip().upper() == "N":
print("Questioner: I'll be here when you're ready. \n")
else:
print("Questioner: What now?) \n")