why is my code not working? (i am following sheepolution tutorial on how to make a game)
Posted: Fri Feb 02, 2024 10:36 am
function Player:keyPressed(key)
if key == "space" then
--to test\/
print("player.x, player.y", self.x, self.y)
--to test/\
table.insert(listOfBullets, Bullet(self.x, self.y))
--also to test \/
for i,v in ipairs(listOfBullets) do
--v:update(dt)
print (i,v.x, v.y)
end
end
end
and if this helps:
function love.update(dt)
player:update(dt)
enemy:update(dt)
for i,v in ipairs(listOfBullets) do
--the thing causing the error
--\/
--v:update(dt)
end
end
if key == "space" then
--to test\/
print("player.x, player.y", self.x, self.y)
--to test/\
table.insert(listOfBullets, Bullet(self.x, self.y))
--also to test \/
for i,v in ipairs(listOfBullets) do
--v:update(dt)
print (i,v.x, v.y)
end
end
end
and if this helps:
function love.update(dt)
player:update(dt)
enemy:update(dt)
for i,v in ipairs(listOfBullets) do
--the thing causing the error
--\/
--v:update(dt)
end
end