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
why is my code not working? (i am following sheepolution tutorial on how to make a game)
Re: why is my code not working? (i am following sheepolution tutorial on how to make a game)
player.x, player.y nil nil
1 nil nil
when i press space/\
1 nil nil
when i press space/\
Re: why is my code not working? (i am following sheepolution tutorial on how to make a game)
Is this all of the code? If not then you need to provide everything you’ve written. Right now I don’t see self.x and self.y being set anywhere.
Also, for context, what, if any, programming background do you have?
Also, for context, what, if any, programming background do you have?
Who is online
Users browsing this forum: No registered users and 3 guests