Code: Select all
function love.keypressed(key)
if (key == " ") and playerDead == false then
shoot()
end
if (key == "j") then
spawnEnemies()
end
end
Code: Select all
function shoot() -- function for shooting
local shot = {}
shot.x = player.x + 50
shot.y = player.y + 40
table.insert(player.shots, shot)
end
Code: Select all
or i,v in ipairs(player.shots) do -- movement for shots
v.x = v.x + 5
if v.x > 800 then
table.insert(remShot, i) -- if shot is out of boundrys destroy them
end
So I need each of these shots to move to where I click when I press the left mouse button