Python代写:CS148 Warehouse Wars

使用Pygame库,代写Warehouse Wars游戏。

Introduction

For the assignment, you will be making a game called Warehouse Wars (the game was first built by Arnold Rosenbloom and some of his classmates when they were in highschool).

To make the game, you will be using a module called Pygame (installed in our lab) to help us build this game.

This top down game takes place in a warehouse. The player, is driving a forklift and can push boxes around the warehouse. The player can in fact push rows of boxes, vertically, horizontally or diagonally. Unfortunately there are monsters in the warehouse roaming around. If they touch the player, the player loses a life.

But these monsters have a weakness. They must be able to move. If they are surrounded, for a certain amount of time, they lose their life and disappear. The forklift driver’s job is to move boxes around the warehouse to surround each monster on all sides and remove them.

Just a reminder, the forklift can push more than a single box at a time, it can push a whole row, column or diagonal collection of boxes at a time, being forced to stop only when the leading box reaches an obstruction (i.e. monster or wall or the end of the stage).

Lab 3 will help you get started on the basic components of this game. After your lab is complete, your game should function as follows (notice that the game shown in the GIF is incomplete; the players and monsters both never reach game over in this version).

Part 0: Getting Started

Go through the Lab 3 instructions to get started on this assignment.

Part 1: The Player

Modify KeyboardPlayer to handle the following:

  1. The KeyboardPlayer should die if a Monster ‘touches’ them (that is, if a Monster asks the KeyboardPlayer to move OR if a KeyboardPlayer asks a monster to move, then the KeyboardPlayer dies). This makes it possible for a Monster to walk right past a KeyboardPlayer. It also makes your code simpler. The exception to this is obviously if you create a type of Monster that specifically dies when the player touches it.
  2. Add diagonal movement to the player (NOTE: you are allowed to change the keyboard buttons to be something other than the arrow keys if you wish, as long as it’s intuitive for the player, and the controls are mentioned in a comment within your code or as game instructions).

Part 2: The Monsters

Task 1: Modify the Monster class

Modify the Monster class to do the following:

  1. Follow instructions in the last part of the lab. That is, add monsters to the stage. Make sure Monsters bounce off from other Actors on the stage.
  2. Complete the is_dead method so that they die when surrounded by boxes on all sides.
  3. Update step so that it checks if this Monster is dead before moving. If it is, this Monster Actor should be removed from the stage.

Task 2: Add Special Monsters

  • Add three different types of monsters in addition to the ones we already have. See below for suggestions of types of monsters you can add. (Hint: Inheritance could be useful here.)
  • You should be using different icons to represent different types of monsters (see Open Source Icon links in the ‘references’ section below).

Part 3: The Boxes/Walls

  1. As described in lab, update Box class so they can be moved.
  2. As described in lab, make a Wall object - that is, an Actor that cannot be moved.
  3. Make a different type of Box that is sticky (use a different icon for this box), so that when a monster moves into it or it gets moved into a monster, the monster ends up being stuck to the box and can’t move. Add some of these Sticky Boxes to the stage, in addition to the standard boxes.

Summary of Game Requirements and Suggested Enhancements

The ones with an (R) are required. All others are suggestions.
Please submit a readme.txt file including a list of all features you implement.

Monsters

Enhancements:

  • (R) Modify the existing Monster so that, when they hit another actor, they bounce back (return in the same direction they came).
  • (R) Modify the existing Monster so that they die when surrounded by boxes on all sides.

Types:

  • (R) At least three different types of monsters. Two in addition to the standard type above. Below are some suggestions.

Monsters that can be pushed
Monsters that can be squished and then die. They can be pushed by boxes until they can’t be pushed further, and then the die.
Monsters that die when the player touches them
Monsters that randomly change direction
Monsters that find a direction that they can move
Monsters that, when they die, explode, removing boxes
Monsters that, when they die, explode, removing boxes and evolve into smarter monsters
Monsters that try to follow the player, wherever they are
Monsters that try to follow the player, when they ‘see’ them
Monsters that explode after living for some time
Monsters that explode when they get close enough to the player
Monsters that camoflage themselves as boxes for some time
Monsters that run away from the player

Boxes/Walls

Types:

  • (R) Boxes that can be moved/pushed.
  • (R) A Wall, that is, an Actor that can’t be moved
  • (R) Boxes that are sticky, so that when a monster moves into it or it gets moved into a monster, the monster ends up being stuck to the box and can’t move.

KeyboardPlayer

Features:

  • (R) KeyboardPlayer dies if monster ‘touches’ them. The Monster has to ask the KeyboardPlayer to move. Similarly, if a KeyboardPlayer asks a monster to move, the KeyboardPlayer dies. This makes it possible for a Monster to walk right past a KeyboardPlayer. It also makes your code simpler. The exception to this is obviously if you create a type of Monster that specifically dies when the player touches it.
  • (R) Add diagonal movement to the player

Change player icon depending on the direction they are moving
Two player game, both players try to kill the monsters
Add keyboard repeat behavour, so the player need only hold a key
Switch to numeric keypad, if available
Player can transport a limited number of times.

Misc

  • (R) Game over
  • (R) Nothing can move off the stage
  • (R) Different icons for different types of things

Different icons for different direction movement
Animations for actors.