Forgot to mention to you Gurok, but you were correct in assuming I'm using love2d.
If either of you are interested, the result of this:
Code: lua
and placing the functions in their respective "Main.lua" functions results in this:
https://www.youtube.com/watch?v=jUnlYE316s4
Thanks for the help! I'm already understanding tables (and using them as arrays) much better.
If either of you are interested, the result of this:
snspr = love.graphics.newImage("SPR/snow.png")
flake_array = {}
function spawn_flakes()
for i = 0, 100, 1 do
flake_array[i] = {}
flake_array[i].x = math.random(800)
flake_array[i].y = math.random(600)
end
end
function flake_update(dt)
for i = 0 ,100, 1 do
flake_array[i].x = flake_array[i].x + math.random(-50, 50) * dt
flake_array[i].y = flake_array[i].y + 1
if flake_array[i].y >= 600 then
flake_array[i].y = 0
end
end
end
function flake_draw()
for i = 0 ,100, 1 do
love.graphics.draw(snspr, flake_array[i].x, flake_array[i].y)
end
end
and placing the functions in their respective "Main.lua" functions results in this:
https://www.youtube.com/watch?v=jUnlYE316s4
Thanks for the help! I'm already understanding tables (and using them as arrays) much better.