Page 1 of 1

HELP!

Posted: Sun Apr 15, 2012 2:23 pm
by Kasperelo
I'm working on a game, really really reaaaaally simple. It's called "Followers"
and you control a mouse and every third second a new red dot appear on the
screen. If you touch a red dot, you lose. Every second counts as one point,
but my problem is, I don't know how to make a start menu, cause if I write:

function love.load()
screenMenu = love.graphics.newImage("graphics/screens/menu.png")
screenPlay = love.graphics.newImage("graphics/screens/play.png")
buttonStart = love.graphics.newImage("graphics/buttons/start.png")
screen = menu
end

function love.update()
end

function love.draw()
if screen == menu then
love.graphics.draw(screenMenu, 0, 0)
else love.graphics.clear(screenMenu)
end
if screen == play then
love.graphics.draw(screenPlay, 0, 0)
else love.graphics.clear(screenPlay)
end
if screen == menu then
love.graphics.draw(buttonStart, 400, 300)
else love.graphics.clear(buttonStart)
end
end

my game screen is white (because screenPlay is white) and whatever I do, it remains
white! HELP!

Re: HELP!

Posted: Sun Apr 15, 2012 2:28 pm
by Nixola
Probably you suffer of the PO2 Syndrome, like me :cry:

Re: HELP!

Posted: Sun Apr 15, 2012 2:32 pm
by Adamantos
Hey,

actually you don't need the love.graphics.clear()-function. The screen is cleared automaticly on every cycle just before your love.draw(...) is called.
So just simple draw your stuff and you're fine...

So something like that:

Code: Select all

function love.draw()
  if screen == menu then
    love.graphics.draw(screenMenu, 0, 0)
  elseif screen == play then
    love.graphics.draw(screenPlay, 0, 0)
  elseif screen == menu then
    love.graphics.draw(buttonStart, 400, 300)
  end
end
After all you need some code in the love.update() section to change the status of the screen-variable.

Re: HELP!

Posted: Sun Apr 15, 2012 2:34 pm
by Nixola
And, just noticed, you shouldn't write 'if screen == menu' 'cause menu and play are nil; you should write 'if screen == "menu' or something like that

Re: HELP!

Posted: Sun Apr 15, 2012 2:37 pm
by bartbes
Also, menu and play are both nil, you probably want "menu" and "play" respectively.

Re: HELP!

Posted: Sun Apr 15, 2012 6:23 pm
by Jasoco
Nixola wrote:Probably you suffer of the PO2 Syndrome, like me :cry:
Isn't PO2 supposed to be dead now that 0.8.0 is out?

Re: HELP!

Posted: Sun Apr 15, 2012 7:06 pm
by TechnoCat
Jasoco wrote:
Nixola wrote:Probably you suffer of the PO2 Syndrome, like me :cry:
Isn't PO2 supposed to be dead now that 0.8.0 is out?
Yes, I believe so.

Re: HELP!

Posted: Sun Apr 15, 2012 7:06 pm
by Nixola
Yeah, it should... But how can we know he's not using 0.7.2? Wait... Adamantos, what OVE version are you using?