Skip to content
Florian Wesch edited this page Apr 5, 2012 · 1 revision

API for programming a map

This documentation has still to be verified.

Tile Types

These describe what a tile behaves like:

  • TILE_SOLID. Not walkable
  • TILE_PLAIN

Tile Graphics Types

These describe what a tile looks like:

  • TILE_GFX_SOLID
  • TILE_GFX_PLAIN
  • TILE_GFX_BORDER
  • TILE_GFX_SNOW_SOLID
  • TILE_GFX_SNOW_PLAIN
  • TILE_GFX_SNOW_BORDER
  • TILE_GFX_WATER
  • TILE_GFX_LAVA
  • TILE_GFX_NONE
  • TILE_GFX_KOTH
  • TILE_GFX_DESERT

world_dig

obsolete

sets type and graphics of the tile at the given coordinate

see also world_set_type, world_set_gfx

usage

ok = world_dig(x, y, TILE_PLAIN, TILE_GFX_SNOW_PLAIN)

parameters

  • x : x coordinate
  • y : y coodinate
  • type : tile type (TILE_SOLID, TILE_PLAIN)
  • gfx : tile graphics type (TILE_GFX_PLAIN, TILE_GFX_SNOW_PLAIN, ...)

return values

  • boolean : if type and graphics could be set

world_set_type

set the type of tile on given coordinates.

Only TILE_PLAIN will be processed. Because of the pathfinding algorithm, it is only possible to remove obstacles.

see also world_set_gfx

usage

ok = world_set_type(x, y, TILE_PLAIN)

parameters

  • x : x coordinate
  • y : y coodinate
  • typ : tile type (TILE_SOLID, TILE_PLAIN)

return values

  • boolean : if type was set

world_set_gfx

set the type of tile on given coordinates.

see also world_set_type

usage

ok = world_set_gfx(x, y, TILE_GFX_SNOW_PLAIN)

parameters

  • x : x coordinate
  • y : y coodinate
  • gfx : tile graphics type (TILE_GFX_PLAIN, TILE_GFX_SNOW_PLAIN, ...)

return values

  • boolean : if type could be successfully set

world_get_type

get the tile type

see also world_set_type

usage

type = world_get_type(x,y)

parameters

  • x : x coordinate
  • y : y coordinate

return values

  • tile type

world_get_gfx

get the tile graphics type

see also world_set_gfx

usage

type = world_get_gfx(x,y)

parameters

  • x : x coordinate
  • y : y coordinate

return values

  • tile type

world_find_digged

find a random digged (PLAIN) tile

usage

x, y = world_find_digged()

parameters

  • none

return values

  • x coordinate of found tile
  • y coordinate of found tile

world_add_food

add amount of food to tile of given coordinates. The amount may be negative.

usage

diff = world_add_food(x,y,1)

parameters

  • x : x coordinate
  • y : y coodinate
  • amount : number of food to add (or remove)

return values

  • number : difference of food count

world_make_border

draws a tile graphic type on coloumn 0 and coloumn -1 and row 0 and row -1

see also world_set_gfx

usage

world_make_border(TILE_GFX_SNOW_BORDER)

parameters

  • gfx : tile graphics type (TILE_GFX_PLAIN, TILE_GFX_SNOW_PLAIN, ...)

return values

  • none

world_fill_all

fill al tiles with given graphic type

usage

world_fill_all(TILE_GFX_SNOW_PLAIN)

parameters

  • gfx : tile graphics type (TILE_GFX_PLAIN, TILE_GFX_SNOW_PLAIN, ...)

return values

  • none

world_tile_center

get world coordianates of the center of tile with given tile coordinates

usage

wx, wy = world_tile_center(x,y)

parameters

  • x : tile coordinate
  • y : tile coordinate

return values

  • x : world coodinate
  • y : world coodinate

game_time

get milliseconds since game start

usage

time = game_time()

parameters

  • none

return values

  • integer