oh, yea i messed up.
i have attached the file to this post now
.
also the code i'm using to store the image and load the sprite looks something like this(i know it's messy, i'm just testing out some things):
global pixelScaleX = 3
global pixelScaleY = 3
global tileGridSizeX = 16
global tileGridSizeY = 16
tileGridSizeX = tileGridSizeX * pixelScaleX
tileGridSizeY = tileGridSizeY * pixelScaleY
type tile
idName as string
name as string
texture as integer
endtype
global tiles as tile[]
function addTileToTileset(tileIdName as string,tileName as string,imagePath as string)
tiles.length = tiles.length + 1
tiles[tiles.length].idName = tileIdName
tiles[tiles.length].name = tileName
tiles[tiles.length].texture = LoadImage (imagePath)
endfunction
addTileToTileset('dirt','Dirt','tiles/dirt.png')
type tilesInMap
tileId as integer
sprite as integer
x as float
y as float
endType
type tilemap
tiles as tilesInMap[]
endtype
global tilemap as tilemap
function addTileToWorld(tileId,gridX,gridY)
tilemap.tiles.length = tilemap.tiles.length + 1
tilemap.tiles[tilemap.tiles.length].tileId = tileId
tilemap.tiles[tilemap.tiles.length].x = gridX * tileGridSizeX
tilemap.tiles[tilemap.tiles.length].y = gridY * tileGridSizeY
tilemap.tiles[tilemap.tiles.length].sprite = CreateSprite (tiles[tileId].texture)
SetSpriteSize(tilemap.tiles[tilemap.tiles.length].sprite,GetImageWidth(tiles[tileId].texture),GetImageHeight(tiles[tileId].texture))
SetSpriteScale(tilemap.tiles[tilemap.tiles.length].sprite,pixelScaleX,pixelScaleY)
SetSpritePhysicsOn (tilemap.tiles[tilemap.tiles.length].sprite,1)
SetSpritePhysicsCanRotate( tilemap.tiles[tilemap.tiles.length].sprite, 0 )
SetSpritePosition(tilemap.tiles[tilemap.tiles.length].sprite,tilemap.tiles[tilemap.tiles.length].x,tilemap.tiles[tilemap.tiles.length].y)
endfunction
//add tiles to tilemap
addTileToWorld(0,0,0)
addTileToWorld(0,1,1)
addTileToWorld(0,2,1)