hmmm... would a standard table be
green = Color.new(19, 20, 21)
red = Color.new(22, 23, 24)
orange = Color.new(25, 26, 27)
yellow = Color.new(28, 29, 30)
shadow my understanding of tables is they give information about the chacacter(s), like health, weapons, ect...correct me if i'm wrong yaustar
hmmm... would a standard table be
green = Color.new(19, 20, 21)
red = Color.new(22, 23, 24)
orange = Color.new(25, 26, 27)
yellow = Color.new(28, 29, 30)
Miniviews:
Spoiler!
yo dtothabreezy screen:blit(player.x,player.y,playerimage) what exactly does that do?
player .x is where your charcter is relative to x of the psp like a graph its the one that goes out y is the one that goes up if you were to minus or plus x it would give the illosion of movment ahhhyou get it
playerimage is what i use so it will blit all of the images i want in what way i want like if i would want playerimage to be him walking when you press right it would say playerimage=walk or something like that in my new animation system it runs off functions but i still keep that as a defualt to make it easier![]()
i don't think so, i mean i'm just lookin at the tuts at evilmana i used a different site before(shoulda use evilmanaOriginally Posted by Shadowblind
) but i think thats just creating colour for the script to use, tables are used to store information about the character, like health, weapons, ammo, ect.
you could do something like that but you would be going out of your way to make that becuz most pepole just put those in at the top yall r the fastest posters ive seen in my life![]()
o and so u know the colors when you put them in are like
the c in the color.new most be capatalized
color=Color.new(red,green,blue)
just remeber that so like to make green youd
green=Color.new(0,255,0) 255 is the most you can put in![]()
dont worry itll come quickly after a while youll get yoused to it
lol i know i do post fast![]()
shadow heres a table:
green = Color.new(0, 255, 0)
Enemy = { }
Enemy[1] = { type = "gargoyle", health = 100 }
Enemy[2] = { type = "vampire", health = 100 }
Enemy[3] = { type = "goomba", health = 100 }
Enemy[4] = { type = "ghost", health = 100 }
Enemy[5] = { type = "zombie", health = 100 }
Player = { }
Player[1] = { weapon = "sword", health = 100 }
Player[2] = { weapon = "knife", health = 100 }
while true do
pad = Controls.read()
screen:clear()
screenrint(5,10,"Player 1 Health: " .. Player[1].health,green)
screenrint(5,20,"Player 1 Weapon: " .. Player[1].weapon,green)
screenrint(250,10,"Enemy Health: " .. Enemy[1].health,green)
screenrint(250,20,"Enemy Type: " .. Enemy[1].type,green)
if pad:cross() then
Enemy[1].health = Enemy[1].health - 5
end
screen.waitVblankStart()
screen.flip()
end
oldpad = Controls.read()
if pad:cross() and oldpad:cross() ~= pad:cross() then
oldpad = pad
if pad:cross() and oldpad:cross() ~= pad:cross() and Enemy[1].health > 0 then
...thats right off of evilmana, i think this is concidered the tabels(arrays)
I have a shot at explaining the concept of a table.
Think of a variable as a storage box. The box can be empty (nil) or it can have something in it. Eg, value, image, text etc.
Now a table is a stack of these boxes and you can refer to them as Box 1, Box 2 etc. You can remove or insert boxes into/out of this stack and you can refer the stack of boxes as a group under one name.
That's the concept, the syntax in Lua can be cofusing so I let the Wiki deal with that.
http://lua-users.org/wiki/TablesTutorial
Note that tables are also refered to as arrays in places.
What you have done here is created a table called 'Enemy' and for each entry/storage box in 'Enemy' created another table that has two entries; 'type' and 'health'.Enemy = { }
Enemy[1] = { type = "gargoyle", health = 100 }
Enemy[2] = { type = "vampire", health = 100 }
Enemy[3] = { type = "goomba", health = 100 }
Enemy[4] = { type = "ghost", health = 100 }
Enemy[5] = { type = "zombie", health = 100 }
fg-54 is having this problem: He has script.lua and script.cmd in the same file, when he runs script.cmd it says no lua file in the directory. Whats wrong?
BTW, can you make a simple game using a table? Thats what evilmana wants me to do...
Therefore, I can open your code and see how its placed.
Miniviews:
Spoiler!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks