timer = timer - 1 * dt
if timer = 0 then
canShoot = true
end
if love.keyboard.isDown(" ","z") and canShoot then
canShoot = false
timer = 100
bullet = {x = player.x + player.img:getWidth() / 2, y = player.y, img = bulletImg }
end
end
function love.draw()
love.graphics.draw(player.img, player.x, player.y)
end
Post the entire .love file for your game? If you're unsure of how to make that, look here. That's the best way for us to help you, to be able to see the entirety of your code and run it as well.
You need a table to store your objects. And then you would iterate through the table and draw and update those objects. Follow this brief tutorial series it will show you the basics of objects and arrays http://www.headchant.com/2010/11/27/lov ... -must-die/
Kingdaro wrote:Post the entire .love file for your game? If you're unsure of how to make that, look here. That's the best way for us to help you, to be able to see the entirety of your code and run it as well.
i want to create and delete objects, i want to make a bullet in my first game with LÖVE2D
bobbyjones wrote:You need a table to store your objects. And then you would iterate through the table and draw and update those objects. Follow this brief tutorial series it will show you the basics of objects and arrays http://www.headchant.com/2010/11/27/lov ... -must-die/
Not Found
The requested URL /2010/12/31/love2d-–-tutorial-part-2-pew-pew/ was not found on this server.