Trouble Drawing Sprites?

Hi there, I’m fairly new to Lua, and while i’m able to understand concepts like OOP, this has me stomped. Basically, I can’t for the life of me get a sprite to draw, even though in my head logically I see no reason why it’s not drawing. Here is the code:


Gem = class()

function Gem:init(x, y)
    self.x = x
    self.y = y

function Gem:draw()
    sprite("Planet Cute:Gem Green", self.x, self.y)

function Gem:touched(touch)


function setup()
    firstGem = Gem(WIDTH/2, HEIGHT/2)

function draw()

Forgive me if there is BBCode for code, couldn’t figure it out. Anyway, as you can see that is fairly barebones code. Any idea why it won’t draw?

Your code looks correct. There is sometimes a state bug that comes up for me about once a week which causes drawing to stop. I’ve found the best way to fix this is to just call the rect() function before you draw (then you can delete the rect call once it starts working).

Let me know if this helps at all.

That seems to have worked! There’s a bug for you guys to look into I guess , thanks!

Great app by the way.