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

Hi Mikshaw,
your're right, but I want to access map with simple construct like:

tile=map[x][y]

That's better for human eyes Big Grin

Bye
Christian


mikshaw Wrote:
Odd thing...
I made a table with a single "map={...}" declaration, and it seems to work, but not as I expected.
Having each table entry enclosed in curly brackets apparently makes each entry a table within the map table. I don't know if this is what you wanted, but I had never thought about the possibilities of this type of setup.

Code:
map={
    {'#','#','#','#','#','#','#','#','#','D','#','#','#','#','#','#','#','#' ,'#','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','#' },
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_' ,'_','# '},
    {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#' ,'#','# '}
}
fourth_table=map[4]
print(fourth_table[2]) -- a floor tile

08-22-2007 08:12 PM
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-22-2007 08:12 PM

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

Forum Jump: