generated from mwc/project_game
Compare commits
3 Commits
22a241fd75
...
ed8f4d7126
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed8f4d7126 | ||
|
|
ceac611ad2 | ||
|
|
4a9bcf1d5d |
21
Proposal.md
Normal file
21
Proposal.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#Game Proposal
|
||||||
|
|
||||||
|
##Team
|
||||||
|
I am working individually on this project.
|
||||||
|
|
||||||
|
#Game Overview
|
||||||
|
Title: Dodge
|
||||||
|
Vision: Players dodge the circle's and more scores they get the more faster the circle's start falling making it fun to play.
|
||||||
|
Appearance: The game would be inside a rectangle shaped box with circles inside falling from the top.
|
||||||
|
Interaction: Players will use left and right arrows to avoid the falling circles.
|
||||||
|
|
||||||
|
#Core Mechanics
|
||||||
|
1. Left and right arrows
|
||||||
|
2. Circles falling from the top
|
||||||
|
3. If a circle hits the players, the game ends.
|
||||||
|
|
||||||
|
#Milestone
|
||||||
|
Create the rectangle board with a player that can move to dodge the falling circles.
|
||||||
|
|
||||||
|
#Challeneges
|
||||||
|
I think the most challenging part would be to increase the speed of the circles falling from the top.
|
||||||
BIN
__pycache__/player.cpython-312.pyc
Normal file
BIN
__pycache__/player.cpython-312.pyc
Normal file
Binary file not shown.
7
nav_game.py
Normal file
7
nav_game.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from retro.game import Game
|
||||||
|
from player import Player
|
||||||
|
|
||||||
|
board_size = (100, 25)
|
||||||
|
player = Player(board_size)
|
||||||
|
game = Game([player], {"score": 0}, board_size=board_size)
|
||||||
|
game.play()
|
||||||
20
player.py
Normal file
20
player.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
class Player:
|
||||||
|
name = "player"
|
||||||
|
character = 'O'
|
||||||
|
|
||||||
|
def __init__(self, board_size):
|
||||||
|
board_width, board_height = board_size
|
||||||
|
self.position = (board_width // 2, board_height - 1)
|
||||||
|
|
||||||
|
def handle_keystroke(self, keystroke, game):
|
||||||
|
x, y = self.position
|
||||||
|
if keystroke.name in ("KEY_LEFT", "KEY_RIGHT"):
|
||||||
|
if keystroke.name == "KEY_LEFT":
|
||||||
|
new_position = (x - 1, y)
|
||||||
|
else:
|
||||||
|
new_position = (x + 1, y)
|
||||||
|
if game.on_board(new_position):
|
||||||
|
if game.is_empty(new_position):
|
||||||
|
self.position = new_position
|
||||||
|
else:
|
||||||
|
game.end()
|
||||||
Reference in New Issue
Block a user