Keep getting Table error preventing enemies from showing

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
gamergodx6
Prole
Posts: 2
Joined: Fri Jul 12, 2013 7:20 pm

Keep getting Table error preventing enemies from showing

Post 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.
Attachments
Love2D Game.love
(8 MiB) Downloaded 75 times
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Keep getting Table error preventing enemies from showing

Post 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)
gamergodx6
Prole
Posts: 2
Joined: Fri Jul 12, 2013 7:20 pm

Re: Keep getting Table error preventing enemies from showing

Post 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!
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests