News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Tile based game engine for murgaLua
Author Message
chrimo
Member
***


Posts: 94
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
RE: Tile based game engine for murgaLua

mikshaw Wrote:

Quote:
tile=map[x][y]

Ahhhh. Thank you.
I was trying to figure out how to directly access the nested table, but that syntax didn't occur to me.
The closest I got was something like map[x[y]] before the bulky solution worked and I quit looking =o)


Hi,
with this functions, it is easy to access all map arrays...
Some usefull stuff

Code:
function MapShow()
local x,y;
    for y=1,20 do
        for x=1,#map[y] do
            if (nil~=map[x][y]) then
                print("Tile="..map[x][y].." x="..x.." y="..y);
            end
        end
    end
end

function TileObject()

end

function WindowGetSize()
local x,y;
    x=1;
    while(nil~=map[x]) do x=x+1 end
    x=x-1;
    y=1;
    while(nil~=map[x][y]) do y=y+1 end
    y=y-1;
    y=y*TileSizeY;
    x=x*TileSizeX;
    
    return x,y;
end

--[[
***** MAP WINDOW *****
--]]
TileSizeX=30;
TileSizeY=30;

MapCreate(x,y);
MapShow();
x,y=WindowGetSize()
print("WindowsSize x="..x.." y="..y);


Bye
Christian

08-23-2007 03:15 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
RE: Tile based game engine for murgaLua - chrimo - 08-23-2007 03:15 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: