News:

Function Finder  Find all the functions within source code files

Main Menu

Hell Eagle (Map / Level Mock Up)

Started by kevin, September 06, 2012, 12:19:16 AM

Previous topic - Next topic

kevin

Hell Eagle (Map / Level Mock Up)


About:

  This is a little (none playable) mock up version of Sigtrygg's 'Hell Eagle' game using a standard PlayBASIC map commands to display the game world and player collisions.  Since this version of the  game world is built using maps, we can use RayHitMapPixels to detect line of sight between 'canon' objects and player also, which can be pretty handy. To demo this,  I've left a test mode in which can be seen in the video bellow.  See keys section for how to toggle the mode.


  Moreover, the example is setup to handle loading different worlds (levels) using an external description files.  The dizzy files is just text files, containing various named sections.  The loader, pulls the text file into a string array and skims through it looking for the section names.  When it finds a name it knows, it calls the decoder function that's been written to understand the actions.

  Here's the section that contains the info about what map game we're going to be loading.

  Description Example:
 
Map-Section
       BlockMaskColour   = $00ff00ff
        BlockWidth        = 32
         BlockHeight       = 32
         BlockFileName     = WORLD_Blocks.Bmp
         LevelFileName     = WORLD_Level.Map
#

    So "Map-Section" is the name of group of variables that relate to the game map in this world.  When the loader spots this section name it then calls a function "Load_World_Parse_MAP_Section".  This function then decodes what each variable in this block means.

    To do this, is looks at each string between the (MAp-Section and # tags). If the tag has an ='s character in it, it splits this into two new strings. One name KEY$ and the Other Value$.  So anything on the LEFT hand side of the equals in the KEY name, while the stuff on the right hand side  is this keys value (in string form).  In this particular example, i'm trapping the key names with a SELECT/CASE statement and writing the values into a  TYPE that. Once the loader has collected all the variables in a section it return to a main loop and continues on look for more section names.

    Lost ? Well have a closer look at the "Load_World(LevelNumber)" function. 


Object Handler:

    If you looked through this program you'll noticed that the main objects types are all handled using the same.  The approach uses a slightly more
object orientated way, where new object types are inherited from basic "tGameCharacter" type.  Normally if we have different object types within
an array/list we've need to write some handler code to select the various the handler code for each type.  But here we've spun this around somewhat.
  Where we can handle the  creation/deletion/updates etc from common set of functions that we don't have to update.

    What it does, is when we create a new character we allocate the new character type in our characters array.  Then call the Init_Character() function.  Inside this function, it uses the character 'class name' to locate any declared a CREATE/DELETE/AI/DRAW functions.  It treats these as this object class actions.

  The init function expects action in the name of the class name with the action attached append to it.  So if you added a "Dragon" class of characters, the frame work would check if there's a Dragon_CREATE(Index) function.  if it's there, the INIT_Character function will call this when setting up this character type.  The same goes for DELETE , AI and DRAWING.  The frame work calls your function if it exists.  The calling is done using  PlayBASIC's CALLFUNCTION operation.
   
  This allows us to append functionality into the basic Update_Character layer without having to modify that code.  If you really wanted you could basically use type of approach between different games.  The advantage being you'd basically write your frame work functions once and then forget.   


Controls:

    Mouse = Move the Ship
      ESC = EXIT
    Enter = Toggle Line of Sight Impacts between canon and player

 



Credits:

      Original Game Concept and Media By: Sigtrygg



Requirements:

          This example is requires at least PlayBASIC V1.64n3 Beta4/5... 


Video:

     
   



Related Articles:

    * My second game: Hell Eagle by Sigtrygg

    * PlayBASIC V1.64N2 (Work In Progress) Gallery


Download: