how to call an array to draw an object after a certain amount of DT has passed?
Posted: Sat Oct 28, 2023 2:49 am
im currently working on my first game, and i have a way to brute force a functionality thats good enough for this project, but with significantly more lines of code than id likely need if i could figure out how to call an array.
and than doing the same thing in love. draw() with the same numbers but draw instead of update.
i know how to set up an array to draw something every time a key is pressed, but im not sure how to call it once my counter variable reaches certain numbers
additionally, how would i increase the required counter number each time the array draws a new object?
Code: Select all
Counter = 0
function love.load ()
require "enemy"
enemy = Enemy()
enemy2 = Enemy()
enemy3 = Enemy()
enemy4 = Enemy()
--[[ect...
function love.update(dt)
Counter = Counter + dt
if counter >= 0 then
enemy:update(dt)
end
if Counter >= 3 then
enemy2:update(dt)
end
if Counter >= 6 then
enemy3:update(dt)
end
if Counter >= 8.6 then
enemy4:update(dt)
end
--[[ ect...
i know how to set up an array to draw something every time a key is pressed, but im not sure how to call it once my counter variable reaches certain numbers
additionally, how would i increase the required counter number each time the array draws a new object?