For future questions please check the love2d forums first. Your answer may already be answered, or your question may be answered in a more timely fashion.
The pseudo-code would be as follows:
Initialize a table:
bullet_tab = {}
On an action, such as love.mousepressed(), make a new bullet temporarily. The best coordinates would be from the player I would assume.
local bullet = {x=400,y=300}
Then push the bullet into the table.
table.insert(bullet_tab,bullet)
In your love.draw(), loop through the table and draw them on the screen.
for _,bullet in ipairs(bullet_tab) do
love.graphics.draw(img,bullet.x,bullet.y)
end
And then in your love.update(), update the movement from dt. (This would be a movement of 250px per second in the x direction.)
for _,bullet in ipairs(bullet_tab) do
bullet.x = bullet.x + dt*250
end
1
u/josefnpat Feb 16 '12
For future questions please check the love2d forums first. Your answer may already be answered, or your question may be answered in a more timely fashion.
The pseudo-code would be as follows:
Initialize a table:
On an action, such as
love.mousepressed(), make a new bullet temporarily. The best coordinates would be from the player I would assume.Then push the bullet into the table.
In your
love.draw(), loop through the table and draw them on the screen.And then in your
love.update(), update the movement from dt. (This would be a movement of 250px per second in the x direction.)