Re: About dt...(edit: and something else)
Posted: Thu May 31, 2012 3:44 am
That article is saying exactly what I wanted to say. I mean, I'm reading the tutorial...and everything's fine, but suddenly, some word comes up, that I understand, so I keep on reading, and then I stop...and I'm like: "What the fuck does that mean?", and then I'm back on the start of the tutorial, reading it all again, trying to make some sense of it.
Other times, I just run into a word that I don't even get, I translate it, but it still makes no difference, when it comes to me understanding whatever the tutorial is about.
Anyway, that was a nice read for me.
I like the idea for that beginner tutorial. Sort of like, making a dairy of my learning process, and share it later, when I'm more experienced. I would definitely like to give something in return, to the community that is teaching me.
Yep, I get your example, and that's what I was thinking.
As for:
I just don't understand how those two things are the same, while the they're almost same in the size. Shouldn't there be some values for enemies, different values...
I mean, if I had 100 enemies, and all 100 enemies have completely different stats, how could I deal with that. other than typing it all out. Say, if we have Strength, Endurance and Agility, and these 100 enemies have different amount of each of those stats...is there really a way of setting stats for them, without actually typing them all out separately, for every different enemy?
Could you give me a real code with tables, to see if I can make any sense of it?
A code with nothing, but a usage of tables. I want to see how it is written, and used.
While looking at the example above, I'm wondering what is "for a = 1" and "#enemies do"...and what is "a" representhing, and how does that little code affect 100 different things, unless it's just a copy of 100 enemies, that are the same in essence.
Anyway, yeah, a real code example with just tables, and their usage, and nothing else would be nice. Maybe a .love file where I can see the results, and with enough comments in the code, that explain what is doing what, when you actually turn the game on, and see the result. I think that would be able to help, not just me, but all beginners that are having hard time with tables.
EDIT:
@Lynesth
You're good at this xD
Let's see if I get it, I think I do...
apple = {}
apple.one = 10
apple.two = 20
apple.three = 30
Now, if I wanted to see the price of all three apples together, I would do...
love.graphics.setColor(255, 255, 255)
love.graphics.print(apple.one + apple.two + apple.three, 50, 50)
That would, I'm pretty sure, print the number 60. Now, what I've been wondering after reading your reply...
If I use this method to define the table...would apple.one's value still be accessible by using apple[1]? or apple.two's value, by typing apple[2]?
or does that just apply to the method where you make table like "apple = { value, value, value...}"?
I wanted to try something more complicated, but I just couldn't figure it out...let's say now, all enemies have 3 stats (strength, agility and endurance), and I want to spawn 3 different enemies (different graphics), but I also want them to have different stats, how would I do that through tables, and is it possible?
or do stats need to be set manually for every enemy, as well as graphics?
I just don't see how tables can reduce the amount you're typing, because...you still need to write where the graphic is, the values in the table...
Could you do something like what I've asked above, I want to see how would you go on about doing that. I think I do understand the basic tables, but it feels like it has much more depth to it, that I don't understand yet.
Other times, I just run into a word that I don't even get, I translate it, but it still makes no difference, when it comes to me understanding whatever the tutorial is about.
Anyway, that was a nice read for me.
I like the idea for that beginner tutorial. Sort of like, making a dairy of my learning process, and share it later, when I'm more experienced. I would definitely like to give something in return, to the community that is teaching me.
Yep, I get your example, and that's what I was thinking.
As for:
Code: Select all
for example:
enemies = {}
for a = 1, #enemies do
enemies[a] = {}
enemies[a].x = 0
enemies[a].y = 0
end
That just did what this did except for 100 instead of 1.
enemy_1_x = 0
enemy_1_y = 0
I mean, if I had 100 enemies, and all 100 enemies have completely different stats, how could I deal with that. other than typing it all out. Say, if we have Strength, Endurance and Agility, and these 100 enemies have different amount of each of those stats...is there really a way of setting stats for them, without actually typing them all out separately, for every different enemy?
Could you give me a real code with tables, to see if I can make any sense of it?
A code with nothing, but a usage of tables. I want to see how it is written, and used.
While looking at the example above, I'm wondering what is "for a = 1" and "#enemies do"...and what is "a" representhing, and how does that little code affect 100 different things, unless it's just a copy of 100 enemies, that are the same in essence.
Anyway, yeah, a real code example with just tables, and their usage, and nothing else would be nice. Maybe a .love file where I can see the results, and with enough comments in the code, that explain what is doing what, when you actually turn the game on, and see the result. I think that would be able to help, not just me, but all beginners that are having hard time with tables.
EDIT:
@Lynesth
You're good at this xD
Let's see if I get it, I think I do...
apple = {}
apple.one = 10
apple.two = 20
apple.three = 30
Now, if I wanted to see the price of all three apples together, I would do...
love.graphics.setColor(255, 255, 255)
love.graphics.print(apple.one + apple.two + apple.three, 50, 50)
That would, I'm pretty sure, print the number 60. Now, what I've been wondering after reading your reply...
If I use this method to define the table...would apple.one's value still be accessible by using apple[1]? or apple.two's value, by typing apple[2]?
or does that just apply to the method where you make table like "apple = { value, value, value...}"?
I wanted to try something more complicated, but I just couldn't figure it out...let's say now, all enemies have 3 stats (strength, agility and endurance), and I want to spawn 3 different enemies (different graphics), but I also want them to have different stats, how would I do that through tables, and is it possible?
or do stats need to be set manually for every enemy, as well as graphics?
I just don't see how tables can reduce the amount you're typing, because...you still need to write where the graphic is, the values in the table...
Could you do something like what I've asked above, I want to see how would you go on about doing that. I think I do understand the basic tables, but it feels like it has much more depth to it, that I don't understand yet.