NewMap
MapIndex = NewMap(NumbOfLevels)
 
Parameters:

    NumbOfLevels = The Number of levels you like to assign this map
Returns:

    MapIndex = The Index of the newly created Map
 

      NewMap initializes a self contained mapping system, with provision for a user defined number of levels to be stored within it.

      The Map is the parent system. It's used to house the various ingredients needed for creating 2D maps. Which are, the Block Set (the tile graphics), the Levels (layers to those familiar with Mappy) and any Block animation information.

      Each map can only have one set of Block graphics and block animations embedded within it. But there's no limit to the number of levels a map can house.

      Each level within a map, will use that maps Block Graphics and Animations when the level is drawn. This allows you to store many different levels that share the same Block graphics and animations together. Moreover, each level can also have an independent size and different drawing settings if needed. So some can be transparent, others can be solid.

      In case your unsure, Mapping is used in all sorts of 2D games. And are generally used to create a larger playing area than the screen. You would no doubt have seen them in countless classic games from shoot-em-ups like R-Type and Xenon, through to plat formers like Rainbow Islands, gods, Sonic, Mario and many many more.

      Conceptually, a level is nothing more than a large grid (array if you will) of block numbers. When the level is drawn, PlayBasic uses the level blocks numbers to draw the corresponding block graphic. So large worlds are really just made up of smaller block fragments.

      I strongly recommend reading the Maps tutorial in the about section and checking out the Map examples that can be found in the PlayBasic/Projects/Examples/Map folder




FACTS:


      * Maps are a big container that stores your your Maps Block Graphics, Levels and Block Animations altogether

      * To import/load Block Graphics into a map see CreateMapGFX, LoadMapGFX

      * To attach a level to your map see Createlevel, Newlevel.

      * Please read the MAPS tutorial in the About section.





Mini Tutorial:


      This example will create a map with provision for 10 levels. Each level can be any size you like.

  
; Create a new map with room for 10 levels.
  MyMap=NewMap(10)
  
; Display the Info about this map.
  Print "Map Status:"+Str$(GetMapStatus(MyMap))
  Print "Number Of Levels:"+Str$(GetMapLevels(MyMap))
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  
  


This example would output.

  
  Map Status:1
  Number Of Levels:10
  

 
Related Info: CreateLevel | CreateMap | CreateMapAnim | CreateMapGfx | DeleteMap | LoadMapGfx | MakeMapGfx | Maps | NewLevel :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com