Challenge #20 - Boulder Dash / Rock Fall (Mini Game)

Started by kevin, August 02, 2010, 02:02:49 AM

Previous topic - Next topic

kevin





Challenge #20 - Boulder Dash / Rock Fall  (Mini Game)


   With this challenge were going to look at building another version (yet simplified) of a classic 8bit game called Boulder Dash.  At it's heart, Boulder Dash was arcade styled problem solving personified.    The objective was simple, the player collects the required number of treasures (in this case diamonds) in order to make their way to the levels exit.   The tricky part was that the diamonds we're placed within the levels in such a way that  the player often needed carefully move/push/drop stones to in order solve the puzzles.      


   In the original game, there was a number of different environmental object & character types to aid in the creation of more complex levels as you progressed,  in our version though,  we're going to simplify the game down to it's bare minimum object, those being the  SOLID WALLS,  AIR, DIRT, ROCKS and DIAMONDS.  Where each different object type has it's own behavior.  

 
   object behaviors

     WALL          =  No logic,  walls don't move, they block all other object types from being pushed or falling through them.

     AIR           =  No logic, objects can pass through air.  So rocks and diamonds will fall if a AIR cell is bellow them, or they be pushed LEFT/RIGHT if a air cell is on the other side of the ROCK/DIAMOND being pushing..  The player can walk through AIR.  

     DIRT          =  No logic, ROCKS & DIAMONDS sit on top of DIRT.  If a DIRT cell is removed from underneath the ROCK/DIAMOND the object falls Down.  The player can move through (dig) dirt, upon doing this the DIRT cell is replaced with an AIR tile.  Objects can't be pushing through dirt though.  


     ROCKS        =  Have a falling behavior, and  act under gravity.  So a ROCK with fall unless it's supported by another hard object, such as WALL, DIRT, or another ROCK.    If a ROCK falls upon a DIAMOND, the DIAMOND explodes and is replaces, the diamond and the supported cells with Diamonds.    If a ROCK falls upon the player, the player is killed.   The player can push the rock LEFT/RIGHT, provding there's and AIR tile on the other side.  Only individual ROCKS and can be pushed though.  


     Diamonds    =  USe the same  falling behavior as rocks, so they act under gravity.  And will fall  unless supported by another hard object, such as WALL, DIRT, ROCK, or Another DIAMOND.    If a DIAMOND falls upon a ROCK, nothing happens.   If the Diamond falls upon the Player, the player is killed.


   The level is made up of an grid (2d array) of, each cell in the array is one object types,  moreover objects don't move on a per pixel basis, they move from cell to the cell.  So you'll need to limit the speed of the program to avoid it running way too fast.



 Sample LEVEl

 #=WALL
 *=DIRT
 P=Player
 @=Diamond
 o=ROcK

 Space=air

 X=EXIT


 ############################################
 #******************************************#
 #******************  **********************#
 #***ooo********@**********  @*************X#
 #*****o ****** ****************************#
 #*****o* ***** ******o*********************#
 #******* *****o******oo********************#
 #*P********** ********o********************#
 #*********o** ****@***oo***********@*******#
 #**********o* ########  *******************#
 #***ooo  *oo********** *******  ***********#
 #******ooooo**********@********************#
 ############################################
 
 

   The Player can move LEFT/RIGHT/UP/DOWN.    The player can move through AIR, DIRT tiles at will, but not WALL tiles.    The Player can interact with ROCKS by pushing them LEFT or RIGHT.  If the player moves over a diamond the treasure is collected.    If a ROCK, or DIAMOND falls upon the player, this kills the player.  




   If the player dies, the game is over.    

    Knowledge Requirements In this challenge

        * Understanding of Variables & Arrays
        * Understand of basic graphics commands
        * User input
        * Movement / Animation
         & Collision

     The objective of this and programming challenge is not about creating a pretty result,  it's about the journey.  Here, we're not trying to remake the original  game, just a simplified version to help understand how we program game mechanics.   As such,  don't concern yourself with visuals, if you don't have any graphics, then use circles, boxes, shapes (whatever) to represent the various object types.  Making it work is much more important than what it looks like.     Once you've got a basic version running,  then sure go nuts and add all the polish you want (pretty graphics / sounds/ better ai etc etc).     Have fun !


Reference Materials

   Boulder Dash (level #1) C64 version   (youtube)
   


   Boulder Dash C64 version  (youtube)
   





Submission

* Submissions can be written in any version of PlayBasic

* Submission can only be accepted in Source Code form only.

* Authors can use external Media (images/music) provided you created the media/and or have permission to distribute the includes media or the Media is in the public domain.

* Zip up your Submissions and please try to keep it smaller than 500K !

* Authors automatically give consent for their submission(s) to distributed and used for promotional purposes via UnderwareDesign.com, PlayBasic code tank.

* Authors can submit as many times as they like.

* To make a submission, zip up your projects source code + media and either post it in this thread, or create your own thread in either the Source Codes or Show Case forums and post a link bellow.



Dead Line

    Anytime before the next ice age



Prizes

    * The best submissions will be periodically highlighted through the PlayBasic IDE news service/News Letters or on Twitter