Page 1 of 1
Keep getting Table error preventing enemies from showing
Posted: Fri Jul 12, 2013 7:44 pm
by gamergodx6
I'm new to the Love scene, and I have been trying to make a game similar to Halo 2600, but am unable to get any of the enemies or "shots" to show up on the display. I can get most things to work, such as collision and music but I keep getting an error based around the Table and I was wondering if I could get any help here. I don't really understand the error so I thought this would be the best place. When I fix one error, it seems that another creates itself. Please help. Attached is the .love file.
Re: Keep getting Table error preventing enemies from showing
Posted: Fri Jul 12, 2013 8:09 pm
by micha
Hi, I made three changes in your code, to make it run.
1) There is an "end" missing in line 56
2) a variable cannot hold an image and a table at the same time. To fix this replace this:
Code: Select all
player = love.graphics.newImage("Flower.png")
by this
Code: Select all
player = {}
player.image = love.graphics.newImage("Flower.png")
3) The drawing has to be adapted accordingly to:
Code: Select all
love.graphics.draw(player.image,px,py)
Re: Keep getting Table error preventing enemies from showing
Posted: Fri Jul 12, 2013 8:58 pm
by gamergodx6
micha wrote:Hi, I made three changes in your code, to make it run.
1) There is an "end" missing in line 56
2) a variable cannot hold an image and a table at the same time. To fix this replace this:
Code: Select all
player = love.graphics.newImage("Flower.png")
by this
Code: Select all
player = {}
player.image = love.graphics.newImage("Flower.png")
3) The drawing has to be adapted accordingly to:
Code: Select all
love.graphics.draw(player.image,px,py)
Thank you!