TableMap 3 - Gonow32/Impulse GitHub Wiki
TableMap 3
This page covers the basics of TableMap 3, a game API included with Impulse Build 74 and above. If you want games made with this API to work on RedCast, you will need to include the API in the apis folder on the disk so it is automatically installed.
Creating your Game object
TableMap 3 is semi-object oriented. This means you will need a Game object created by TableMap 3. This requires two things: a Map and a Player. You can create a map with tableMap.createMap(width, height, backColour). 'width' is the width of the map. 'height' is the height of the map. 'backColour' is the colour of the tiles on the map when it is created. Using tableMap.createPlayer(colour, char, x, y), you can create a Player object. 'colour' is the colour of the player and 'char' is the character inside the player. 'x' and 'y' are the starting coordinates for the player. Once you have these objects, you can use tableMap.createGame(map, player) to create the Game object.
Rendering your game
Once you have your Game object, you can easily render the map and player onto the screen. To do this, simply put tableMap.render(game). This will draw your game onto the screen. However, you must keep this updated.
Moving the player
It's easy to move the player in TableMap 3. There are 5 functions. 4 out of 5 implement basic collision detection.
Functions:
tableMap.move(game,x,y)
tableMap.moveUp(game)
tableMap.moveDown(game)
tableMap.moveLeft(game)
tableMap.moveRight(game)
The basic tableMap.move function won't process collision detection but the other four will.
Custom maps
TableMap 3 can load custom maps as of Build 78 of Impulse. This means you can load in maps that you've created in a level editor for use in your game. You can do this by using tableMap.loadMap(file). This will return a Map object.