Instructor: Trish Cornez


CS223 Lab 10 Decision Making Prey vs. Predator

Exercise a: Sprite animation for Karin, the Street Fighter.

      The final Predator/Prey Game will feature a sprite animation. In this exercise, Karin, the Street Fighter will be constructed as a sprite animation. In the remaining exercises, Karin will be controlled using keyboard input. She will b e given the ability to kick and punch and walk in forward and backward movements. Her default behavior is a dynamic "wait" cycle, which is an animation of her in a ready position waiting to perform a specified action.

      Karin's actions and default waiting animation have been constructed using a sprite sheet. The sprites shown below will be used to build her kick action.

Task 1: Download the following file and examine the sprite animations of Karin: StreetFighter.fla.
Task 2: Using the kick sprites, build the remaining kick sprite animation for Karin. Use the following guide.






Exercise b: Add interactivity to the StreetFighter.


    1. Write the code to enable interactivity for Karin. Use the following keys:
      • kick: Up Arrow Key
      • punch: Down Arrow Key
      • Walk forward: Right Arrow Key
      • Walk backward: Left Arrow Key
      Remember that rer default behavior is a dynamic "wait" cycle. This is what happens when no keys are pressed.
    2. For a more fluid and controlled movement, provide a mechanism that will wait for the previous animation to stop playing before a new one will begin. Otherwise the movement can become jumpy. For example, pressing the punch button followed by a kick button should display a complete punch animation before the kick animation should be played. The kick animation should not cancel out the punch animation when it is only half way through. This can be accomplished by using a queue list to store several keystrokes.
    3. Use a Timer mechanism to move Karin forward and backward while the sprite action unfolds.


Get Adobe Flash player


Exercise c: The Complete Predator Prey Game. This final game app must be uploaded to Moodle.

Build a turn-based logic board game, as shown below. Requirements:
  1. You may use any sprite animations or artwork you wish.
  2. In this turn-based game the player takes a turn followed by the opponent taking a turn.
  3. At the start of this game, a logic board is displayed containing a collection of square obstacles, a player (prey) and an enemy (predator).
  4. The square obstacles block a pathway. Code the board so that 10%-20% of the interior contains obstacles.
  5. The player is first to take a turn, using the arrow keys to move up or down a single square on the keyboard as long as there are no obstacles in his or her way. Once the player has taken his or her turn, the enemy will compute its next move.
  6. To win the game the player must navigate around the board obstacles, avoid colliding with the enemy, and successfully exit through the single opening on the board.
  7. When it is the opponent's turn, it will actively hunt down the player.
  8. If a collision with the enemy occurs, the player is defeated.