Barebones Isometric Map + Camera Panning

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
arquivista
No longer with us
Posts: 266
Joined: Tue Jul 06, 2010 8:39 am
Location: Insert Geolocation tag here
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by arquivista »

Robin wrote:
arquivista wrote:Robin, I forgot to answer to this before. Sorry the late response and my ignorance but I don't think I reached well your points about the Quad or use directly the string as keys. About the Quad are you talking of have of alphabet image to be "quad" or there is a direct way of LOVE translate/raster the the strings "a","b", etc to images? And about "use string as keys" can you explain better this point?
Hm, I simply meant that you can have {a = someQuad, b = someOtherQuad} just as well as {someQuad, someOtherQuad}. The difference is that you can use a and b in your map file without having to convert it to a number.
Ah ok Robin, as you saw in another thread i didn't knew about the method of Lua's "dictionary tables" but I really wouldn't even think do the tile assignment in that way declaring one by one all the tiles in a table (imagine declare all charset!). Unless of course using a clever way doing a kind of For "string" loop. Perhaps something like this would do the trick?

Code: Select all

tiles = {}
for x=0,255 do
     tiles[y] = string.char(x+1)
     tiles.gfx[y] = love.graphics.newImage( "tile_"..y..".png" ) -- or in a quad format for single file
end
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by Robin »

Well, you could do something like

Code: Select all

local tiles = "abcdefgx/\=~" -- just an example
for i = 1, #tiles do
     local tile_char = tiles:byte(i)
-- ...
end
But I'm not sure which would be the easiest. Depends on the situation.
Help us help you: attach a .love.
User avatar
arquivista
No longer with us
Posts: 266
Joined: Tue Jul 06, 2010 8:39 am
Location: Insert Geolocation tag here
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by arquivista »

Robin wrote:Well, you could do something like

Code: Select all

local tiles = "abcdefgx/\=~" -- just an example
for i = 1, #tiles do
     local tile_char = tiles:byte(i)
-- ...
end
But I'm not sure which would be the easiest. Depends on the situation.
Didn't tested yet your solution but I believe that your method turns to be much better since that way we can control the order or customize the charset used instead of do a straight load according the system charset like I was trying to achieve. In my way would be problematic when jumping in unwanted chars and would only work well in straight sequences like a-z. Nice thought Robin.
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 68 guests