- Prof. Dancy's Site - Course Site -
The year is 2022. Personal space transport is common and you have taken your space ship out exploring. You find an ancient abandoned planet and decided to land and investigate. There was a huge storm as you landed and your ship now lies in pieces on a landing pad. There is no oxygen in air but you are able to move around in your rover. You have a repair manual, which tells you how to fix your ship, but you don't have the needed spare parts.
You see strange items scattered around on the ground. Maybe they will be useful. You also see strange glowing orbs big enough to swallow your rover. When you touch one, you get sucked in and appear in another place with items and orbs. The orb was a portal! When you re-enter the same portal, it takes you back where you came from.
Your goal is to move about the portal system and collect enough spare parts to fix your ship.
Phase 2 | Phase 3 | Phase 4 | Phase 5 |
First, copy the code from the following directory: ~csci204/2020-fall/student/projects/p2Dancy/
We have provided an executable prototype of the game. You should see the following set of files in your project folder:
Game.py
the file you need to edit. Contains the framework for the game. Also contains code that communicates with the GUI (Graphical User Interface)gameboard.py
and graphics.py
contains the remainder of the GUI code. You should not have to edit these files and unless otherwise noted, you should not edit these files..ppm
files that provide the image files for the gameThe GUI makes use of a Point
class - a basic data structure that simply holds an x
and y
attribute. This class is used in the get_rover_location()
and get_image()
methods.
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
go_up
, go_down
, go_left
, and go_right
methods. When the arrow buttons are pushed in the user interface, these methods are automatically called. Your Rover
should move one space in the direction specified.
Look carefully at the implementation of get_image
in Game.py
. It accepts a Point
as the input, which (as we showed earlier) contains Point.x
and Point.y
.
get_image
function for every single coordinate point in the room. Now, we are operating in two dimensions, and instead of returning an object, we are directly returning the image name.Point.x
and Point.y
. For example, if a portal is at point x
and y
, return "portal.ppm"
."rover.ppm"
here.get_rover_location
: this function should return the current position of your rover - expressed as a Point
object
There are a lot more methods that you'll eventually need to complete as we progress through the game development.
The goal of part 1 is to focus on your class design and to build movement into the system.
Tasks
, Inventory
, and rest of the buttons do not have to work.The rover must start at a random location in the room.
The ship must have at least 3 different kinds of ship components and at least 6 ship components in total.
There will be a random assortment of parts (gears, screws, cake, etc.) scattered around the room. There must be at least 4 different kinds of parts.
There will be at least 2 portals. Use randomness for both the number and location of the portals
No two items (ship components, parts, portals) may be in the same location
Although the design is largely up to you this time, think carefully about how you will structure your program. We are going to progressively expect better design from you each project, and a portion of your grade will be based on this design. Here are a few things to consider
Portals
, Parts
, and ShipComponents
all have certain things in common. How should you express that relationship?Room
that you are in. Keep in mind that you will have to create many rooms in future parts of this project.Rover
Think carefully about the relationships between these objects. This is the hard part of design! But if you do it right, it will make all your future parts go much smoother.
Graded item | Number of points |
---|---|
Room Setup | |
The rover and ship components and the parts all have working images | 7 pts |
The ship must have at least three different kinds of ship components and at least 6 ship components total | 6 pts |
Use randomness for the number of the parts | 6 pts |
Use randomness for the location of the parts | 6 pts |
The number of parts in a room should be roughly similar to image in instructions (the room shouldn't be completely covered in parts) | 6 pts |
There will be at least 2 portals. Again, use randomness for both the number and location of portals | 6 pts |
No two items (ship components, parts, portals) may be in the same location. | 5 pts |
The rover starts on a random location in the first room | 4 pts |
General Movement | |
The rover goes up | 6 pts |
The rover goes down | 6 pts |
The rover goes left | 6 pts |
The rover goes right | 6 pts |
Edge/Item Movement | |
Top Edge | 4 pts |
Bottom Edge | 4 pts |
Left Edge | 4 pts |
Right Edge | 4 pts |
The rover can stand on things (empty spaces, ship components, parts, and portals) | 4 pts |
Good design principles used | 10 pts |
Total | 100 pts |