Robots Revenge - clash detection

Or more accurately, collision detections.

This is where we are at (download the entire folder though, as it contains media used by the program).


and the entire folder

RobtsR folder

Whaere are we up to wat this stage?

The begin_game procedure is now a loop that spawns each of the rounds, monitoring how many lives the player has left, and whether or not they survived the round. It also checks for whether a quit from the loop from the returned (pressing 'Q' in a round)

Next the play_round routine is called. This

  • loads the music and sounds
  • creates alist of robots, with initial positions, and checking that robots don't occupy the same space, also setting up the animation point of the robot
  • adds the exit
  • sets up the player
  • puts the robots, player and exit onto the arena bitmap
  • then its starts the movement loop

every round of the loop we

  • check for key presses
  • play a footstep sound
  • chenge the player bitmap animation
  • clear the arena bitmap
  • blit the exit and the player onto the arena
  • calculate the new positions of the robots, and blit the robots onto the arena
  • blit the arena to the screen
  • check whether a player position coincides with the player position (within a reasonable distance anyway)
  • checks whether the player has reached the exit
  • sets a caught flag and exits if the player has been caught
  • just exitsif the player has reached the exit

Once the loop is exited

  • if the player is caught, play the death scream and the death animation and reduce the lives
  • if the player reached the exit, blow up the robots (like lemmings), display the message, and not yet implemented, go to the next level (increment the level counter)

The blow up the robot is interesting. I originally thought of doing particles, like lemmings, but that was too involved, so I settled on an animated sprite sheet. This takes a sprite sheet, and refers to each location (in this case) by a table. There are only 16 sprites, so this wasn't too onerous. Unfortunately the table is a little off for each of the sprites, so there is a strange clipping effect - but i quite like it, so I didn't change it. There is also a slight random delay in starting ech one, so they don't all blow up uniformally.

Next, to do, add some actual level design elements, and increase difficulty levels the higher we go. Perhaps add some different types of robot, so there behaviour changes, or is not always the same.

Page 5 - More levels


Quick Links

User menu

Not signed in.

Misc Menu