generated from mwc/project_game
8.1.2024 Creating the Retro Game was a challenge at the beginning, but what helped was to create the Initial Plan of the game name, game description, core mechanics, and challenges. Dr. Proctor helped me with many of the issues to resolve. I was quite happy and empowered that I was able to write and resolve some code issues on my own. Several times I used Microsoft Copilot AI which helped me 1 issue, but final issues didn't work even while I was specific with the questions. Overall, I'm happy with the results of creating a Retro Game, but I would like to resolve Issues #2 and #3. August 1 Final Challenges 1. ISSUE: Scrolling Text Wanted to have “scrolling text,” but I don’t think it can be accomplished within the basic Retro Game I created. RESOLVED: I increased the game board to fit the “Treasures,” treasure longest line, "You discovered Imperial Faberge Eggs!". Within game.py, I moved all the “lines” and “end caps” by 4 increments to center the game with equal spacing on left and right sides. 2. ISSUE: Final Score to state players playing level. I wanted the final score to read the players level after the last “treasure” was acquired and named. To incorporate into the code, “0-30 Beginner, 30-50 Novice, 60 Expert.” NOT RESOLVED: within treasure.py At final score, adding, 0-30 Beginner, 30-50 Novice, 60 Expert? I tried with some code from Copilot A, but it overwrote the score title over the Treasure discovered. And once the player scored 60 points, in the message state at the top read “final_score_message_set: True.” Not what I wanted to appear and I didn’t know how to resolve the code to work. The code follows: DIDN'T WORK: Tried in game. py state = {'score':0, 'lives':3, 'final_score_message_set': False} game = Game(agents, state, board_size, color="white") game.play() DIDN'T WORK: Tried in Treasure.py if not game.state.get('final_score_message_set', False): final_score = game.state["score"] if final_score <= 30: game.state['message'] = "Beginner Treasure Hunter!" elif 30 < final_score <= 50: game.state['message'] = "Novice Treasure Hunter!" elif final_score >= 60: game.state['message'] = "You Win Expert Treasure Hunter!" game.end() # Set the flag to indicate the final score message has been set game.state['final_score_message_set'] = True 3. ISSUE: Automatically reset and move the “Treasures” and “Traps” to a new position on the game board when the player plays the game for a second and additional times. I wanted to make the game interesting and not predictable. NOT RESOLVED: I don't know how to code this to make it work.
131 lines
4.2 KiB
Python
131 lines
4.2 KiB
Python
"""Created by Kathryn Odell-Hamilton
|
|
This retro game is "Lost World Treasures."
|
|
1 Player game.
|
|
The player is looking to discover the 6 World Lost Treasures.
|
|
The player can score 60 points to win the game.
|
|
The player has 3 lives. If the player goes onto a trap, the player loses a live.
|
|
Once there are 0 lives, the player loses and game over."""
|
|
|
|
|
|
from retro.game import Game
|
|
from player import Player
|
|
from wall import Wall
|
|
from wall_vert import Wall_vert
|
|
from endcap import EndCap
|
|
from treasure import Treasure
|
|
from trap import Trap
|
|
|
|
|
|
"""Define Game Board Size, Single Player, Agents, Initial State of Game
|
|
Create the Game, Play the Game"""
|
|
board_size = (48, 20)
|
|
player = Player ((35, 1))
|
|
agents = [player]
|
|
|
|
|
|
"""Left Vert Wall, Top n Bottom End Caps"""
|
|
agents += Wall_vert.vertline((1, 1), 18)
|
|
agents += EndCap.endcap((1, 0), 1)
|
|
agents += EndCap.endcap((1, 19), 1)
|
|
|
|
|
|
"""Top Left Horiz Wall. Top End Cap - Top Left Horiz Wall"""
|
|
agents += Wall.horzline((2, 0), 22)
|
|
agents += EndCap.endcap((24, 0), 1)
|
|
|
|
|
|
"""Left Inner TopBox Vert Wall 1 n 2"""
|
|
agents += Wall_vert.vertline((7, 4), 3)
|
|
agents += Wall_vert.vertline((17, 4), 3)
|
|
"""Top Left Inner TopBox Horiz Wall 1 n 2"""
|
|
agents += Wall.horzline((8, 3), 9)
|
|
agents += Wall.horzline((8, 7), 9)
|
|
"""Top End Caps 1, 2, 3, 4"""
|
|
agents += EndCap.endcap((7, 3), 1)
|
|
agents += EndCap.endcap((17, 3), 1)
|
|
agents += EndCap.endcap((7, 7), 1)
|
|
agents += EndCap.endcap((17, 7), 1)
|
|
|
|
|
|
"""Left Inner BottomBox Vert Wall 1 n 2"""
|
|
agents += Wall_vert.vertline((7, 11), 5)
|
|
agents += Wall_vert.vertline((17, 11), 5)
|
|
"""Top Left Inner BottomBox Horiz Wall 1 n 2"""
|
|
agents += Wall.horzline((8, 10), 9)
|
|
agents += Wall.horzline((8, 16), 9)
|
|
"""Bottom End Caps 1, 2, 3, 4"""
|
|
agents += EndCap.endcap((7, 10), 1)
|
|
agents += EndCap.endcap((17, 10), 1)
|
|
agents += EndCap.endcap((7, 16), 1)
|
|
agents += EndCap.endcap((17, 16), 1)
|
|
|
|
|
|
"""Right Inner Vert wall 1n Horz Wall 1"""
|
|
agents += Wall_vert.vertline((24, 1), 2)
|
|
agents += Wall.horzline((25, 3), 6)
|
|
"""Right Inner End Cap """
|
|
agents += EndCap.endcap((31, 3), 1)
|
|
"""Right Inner End Cap 1 n 2"""
|
|
agents += EndCap.endcap((24, 3), 1)
|
|
agents += EndCap.endcap((31, 3), 1)
|
|
|
|
|
|
"""Right Inner TopBox Horiz Wall 1 n 2"""
|
|
agents += Wall.horzline((25, 6), 6)
|
|
agents += Wall.horzline((25, 9), 6)
|
|
"""Right Inner TopBox Vert Wall 1 n 2"""
|
|
agents += Wall_vert.vertline((31, 7), 2)
|
|
agents += Wall_vert.vertline((24, 7), 2)
|
|
"""Right Inner TopBox End Caps 1, 2, 3, 4"""
|
|
agents += EndCap.endcap((24, 6), 1)
|
|
agents += EndCap.endcap((31, 9), 1)
|
|
agents += EndCap.endcap((24, 9), 1)
|
|
agents += EndCap.endcap((31, 6), 1)
|
|
|
|
|
|
"""Right Inner BottomBox Horiz Wall 1 n 2"""
|
|
agents += Wall.horzline((25, 12), 6)
|
|
agents += Wall.horzline((25, 16), 6)
|
|
"""Right Inner BottomBox Vert Wall 1 n 2"""
|
|
agents += Wall_vert.vertline((31, 13), 3)
|
|
agents += Wall_vert.vertline((24, 13), 3)
|
|
"""Right Inner BottomBox End Caps 1, 2, 3, 4"""
|
|
agents += EndCap.endcap((24, 12), 1)
|
|
agents += EndCap.endcap((31, 12), 1)
|
|
agents += EndCap.endcap((24, 16), 1)
|
|
agents += EndCap.endcap((31, 16), 1)
|
|
|
|
|
|
"""Right Wall"""
|
|
agents += Wall_vert.vertline((38, 1), 18)
|
|
"""Right Top End Cap n Bottom End Cap"""
|
|
agents += EndCap.endcap((38, 0), 1)
|
|
agents += EndCap.endcap((38, 19), 1)
|
|
"""Right Inner wall - top 1st section """
|
|
agents += Wall_vert.vertline((31, 1), 2)
|
|
"""Right Inner End Cap"""
|
|
agents += EndCap.endcap((31, 0), 1)
|
|
|
|
|
|
"""Bottom Wall"""
|
|
agents += Wall.horzline((2, 19), 36)
|
|
|
|
"""Treasures, return as a single instance, object"""
|
|
agents.append(Treasure((34, 7), 1, "You discovered Arc of the Covenant!"))
|
|
agents.append(Treasure((34, 14), 1, "You discovered King Arthur's Sword!"))
|
|
agents.append(Treasure((21, 4), 1, "You discovered Lost Inca Gold!"))
|
|
agents.append(Treasure((21, 11), 1, "You discovered Oak Island Money Pit!"))
|
|
agents.append(Treasure((11, 2), 1, "You discovered Amber Room Treasures!"))
|
|
agents.append(Treasure((4, 13), 1, "You discovered Imperial Faberge Eggs!"))
|
|
|
|
"""Traps, return as a single instance, object"""
|
|
agents.append(Trap((28, 5), 1, "Skeletons killed you with swords."))
|
|
agents.append(Trap((11, 17), 1, "Fell into a pit on spikes."))
|
|
agents.append(Trap((4, 5), 1, "Killed by poison darts."))
|
|
|
|
|
|
state = {'score':0, 'lives':3}
|
|
game = Game(agents, state, board_size, color="white")
|
|
game.play()
|
|
|
|
"""In Player.py, game ends if Player Scores 60 points or gets 0 Lives""" |