Results 1 to 2 of 2

Thread: Lua Tiles???

  
  1. #1
    ST@TIC is offline -Hacks Newbie
    Join Date
    Nov 2006
    Location
    South Africa
    Posts
    39
    Rep Power
    14

    Default

    Hey can any one help me wit lua tilies cause it confuses me lol :posessed:

    thanks


    \"Death be not proud, some have called thee mighty and great, thou art not so\"

  2. #2
    Anti-QJ is offline -Hacks Newbie
    Join Date
    Mar 2007
    Posts
    18
    Rep Power
    0

    Default

    Us this and examine it.

    Tile:

    Code:
    System.usbDiskModeActivate()
     
    tiles = Image.load("tiles.png")
     
    map = {
    	"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
    	"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
    	"mmeaaaaaaaaaaaaaaaaaaaaaaaafmm",
    	"mmdpnnnnnnnnnnnnnnnnnnnnnnpbmm",
    	"mmdokcccccclnkccccccccccclnbmm",
    	"mmdojaaaaafdnbmmmmmmmmmmmdnbmm",
    	"mmdooooooobdnbmmmmmmmmmmmdnbmm",
    	"mmdokccclobdnbmmmmmmmmmmmdnbmm",
    	"mmdobmmmdobdnbmmmmmmmmmmmdnbmm",
    	"mmdobmmmdobdnjaaaaaaaaaafdnbmm",
    	"mmdobmmmdpbdnnnnnnnnnnnnbdnbmm",
    	"mmdobmmmhcghcccccccccclnbdnbmm",
    	"mmdojaaaaaaaaaaaaaaaaainjinbmm",
    	"mmdpnnnnnnnnnnnnnnnnnnnnnnpbmm",
    	"mmhccccccccccccccccccccccccgmm",
    	"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
    	"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
    }
     
    function drawTile(tile, x, y)
    	local tileX = math.mod(tile, 4)
    	local tileY = math.floor(tile / 4)
    	screen:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false)
    end	
     
    while true do
    	pad = Controls.read()
    	if pad:start() then break end
    	screen:clear()
    	for y = 1, 17 do
    		line = map[y]
    		for x = 1, 30 do
    			tile = string.byte(line, x) - string.byte("a")
    			drawTile(tile, x - 1, y - 1)
    		end
    	end
    	screen.waitVblankStart()
    	screen:flip()
    end
    If you have the tiles pic it should look something like this:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •