Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
TileMap enhancement — Gideros Forum

TileMap enhancement

SinisterSoftSinisterSoft Maintainer
edited June 2012 in Suggestions & requests
It would be good if the top bits of a tilemap (16-bit block numbers) could be used to tell the renderer to:

H-Flip
V-Vlip
Rotate by 90 degrees

These 3 bits could be used by a proper map editor to save loads of tilespace.

Likes: Oaf

Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com
Tagged:
+1 -1 (+1 / -0 )Share on Facebook

Comments

  • SinisterSoftSinisterSoft Maintainer
    Another enhancement would be a block number that is not drawn.

    This would allow overlayed/layered maps to be more rapidly drawn.

    Likes: Oaf

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • I think using block number 0 in tiled will give you that effect
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • SinisterSoftSinisterSoft Maintainer
    techdojo: Thanks, will have to check that out...

    Now it just needs the h,v and r bits. :)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • atilimatilim Maintainer
    @SinisterSoft I've implemented horizontal, vertical and diagonal flips. it will be available with the next version. I'm attaching a screenshot of the test case.
    tiled flip.png
    695 x 808 - 141K
    +1 -1 (+3 / -0 )Share on Facebook
  • That will be useful thanks.
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • SinisterSoftSinisterSoft Maintainer
    Will there be a document saying what bits do what, also could you confirm that block 0 will not be drawn.

    I'm in the process of making a map editor for my game you see.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @atilim: Seeing as you have been playing with TileMap, have you looked into isometric maps yet :) (squeaky wheel get the oil and all that)
  • With regards "block 0" not being drawn.
    It's supported by just not adding that tile to the map.

    ie. (code from @Atilim's simple Tiled map reader)
    TileMapSingle = Core.class(Sprite)
     
    function TileMapSingle:init(map)
    	-- local map = loadfile(filename)()
     
    	local tileset = map.tilesets[1]
    	tileset.sizex = math.floor((tileset.imagewidth - tileset.margin + tileset.spacing) / (tileset.tilewidth + tileset.spacing))
    	tileset.sizey = math.floor((tileset.imageheight - tileset.margin + tileset.spacing) / (tileset.tileheight + tileset.spacing))	
    	tileset.texture = Texture.new(tileset.image)
     
    	local layer = map.layers[1]
     
    	local tilemap = TileMap.new(layer.width, 
    								layer.height,
    								tileset.texture,
    								tileset.tilewidth,
    								tileset.tileheight,
    								tileset.spacing,
    								tileset.spacing,
    								tileset.margin,
    								tileset.margin,
    								map.tilewidth,
    								map.tileheight)
     
    	for y=1,layer.height do
    		for x=1,layer.width do
    			local i = x + (y - 1) * layer.width
    			local gid = layer.data[i]
    			if gid ~= 0 then
    				local tx = (gid - tileset.firstgid) % tileset.sizex + 1
    				local ty = math.floor((gid - tileset.firstgid) / tileset.sizex) + 1
    				tilemap:setTile(x, y, tx, ty)
    			end
    		end
    	end
     
    	self:addChild(tilemap)
    end
    To erase a tile use the TileMap:clearTile(x, y) function.

    Likes: atilim

    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
    +1 -1 (+1 / -0 )Share on Facebook
  • atilimatilim Maintainer
    edited June 2012
    @Scouser After some tests, I understood that supporting isometric maps is easier than I expected. Adding a single function to TileMap will be enough as:
    tilemap:setOrientation(TileMap.ISOMETRIC)  --> render tile map as isometric
    tilemap:setOrientation(TileMap.ORTHOGONAL)  --> default, render tile map as orthogonal
    I'll try to implement it as the next version.
    +1 -1 (+5 / -0 )Share on Facebook
Sign In or Register to comment.