NEWMAP

Top  Previous  Next

Syntax

POINTER = NEWMAP(filename as STRING,opt width=0 as INT,opt height=0 as INT,opt frames=0 as INT)

Description

Creates a scrolling tile map and loads the tile images.

Parameters

filename - File name or resource ID to load tile images from.

width - Optional. width of one tile

height - Optional height of one tile

frames - Optional number of tiles the image contains

Return value

A pointer to the newly created map or NULL if the tile images could not be loaded.

Remarks

NEWMAP uses the same image loading routine as LoadSprite. After the map is created and the tile images loaded you must describe where the tiles are placed in the map with the LOADMAPDATA or CREATEMAPDATA/SETMAPDATA functions.

See Also: LOADSPRITE, LOADMAPDATA, CREATEMAPDATA, SETMAPDATA

Example usage

map = NEWMAP(GETSTARTPATH+"mapdata.bmp",64,64)
IF map = NULL
    CLOSESCREEN
    MESSAGEBOX 0,"failed to load map images","error"
    END
ENDIF
IF LOADMAPDATA(map,GETSTARTPATH+"Level.dat") = FALSE
    CLOSESCREEN
    MESSAGEBOX 0,"failed to load map data","error"
    END
ENDIF