Page 1 of 1

Crash on open (Main)

Posted: Thu Jun 27, 2013 10:56 pm
by McMixx
function love.load()
love.graphics.setBackgroundColor( 255, 255, 255 )
end

function love.draw() -- I think this is the problem too (go down)
local x = love.mouse.getX( )
local y = love.mouse.getY( )

love.graphics.setColor( 0, 0, 0, 255 )
love.graphics.rectangle( "fill", xCloud - 0.5, 450, 30, 30 )
end

function love.update(dt)
xCloud = Cloud + 32*dt
if xCloud >= (800 + 0.5) then
xCloud = 0
end
end -- This and up is a problem (Problem stops at my other note)

function love.focus(bool)
end

function love.keypressed( key, unicode )
end

function love.keyreleased( key, unicode )
end

function love.mousepressed( x, y, button )
end

function love.mousereleased( x, y, button )
end

function love.quit()
end

Re: Crash on open (Main)

Posted: Fri Jun 28, 2013 1:20 am
by Ensayia
You don't define xCloud until you use it in update, but you attempt to use it in draw which is called before update.

Defining xCloud and giving it a default value in load may help.

Re: Crash on open (Main)

Posted: Fri Jun 28, 2013 1:22 am
by Boolsheet
Make sure you have read the Forum Rules. If you follow them, it will increase the chance that someone will or can help you.

When you use code in your post, use the [­code] tags to get a formatting that is cleaner and easier to read.

[­code]function love.load()
end[­/code]

Turns into this.

Code: Select all

function love.load()
end
If your game stops with a message on a blue background, we call that an error. A crash is when the whole application terminates in an abnormal way. I assume you got an error message that tells you what went wrong?

In the function love.update, you use the global variable 'Cloud', but you never set a value to it. Lua can't do arithmetic with nil values. I'm guessing that's a typo and you wanted to write xCloud. Set xCloud to 0 in love.load so it points to an actual number when love.update gets executed.

(love.update gets called before love.draw. See love.run)

Re: Crash on open (Main)

Posted: Fri Jun 28, 2013 2:42 pm
by McMixx
Thanks and it's a crash (crashes the whole thing), not a error.

Thanks (:

Re: Crash on open (Main)

Posted: Fri Jun 28, 2013 3:56 pm
by Boolsheet
Well, that should not happen. Can you give us more information about your system?

With such simple code, we usually have to blame the graphics driver or other software that interferes with LÖVE.

Re: Crash on open (Main)

Posted: Fri Jun 28, 2013 4:04 pm
by raidho36
From my (short) experience with löve2d, I can tell that if it's crashes upon start then it fails to compile your Lua code. It actually quits gracefully rather than crashes it but doesn't leaves any kind of error message. One most frequent case is syntax error. You should check your file very carefully for missing (or extra) brackets, periods and mispelled keywords.

Re: Crash on open (Main)

Posted: Fri Jun 28, 2013 4:18 pm
by micha
In one line you need to replace this:

Code: Select all

xCloud = Cloud + 32*dt
by this:

Code: Select all

xCloud = xCloud + 32*dt
and in the love.load you need to add this line:

Code: Select all

xCloud = 0
However, not doing so should only result in an error (blue LÖVE-window with an error message), not a crash.

Re: Crash on open (Main)

Posted: Fri Jun 28, 2013 5:31 pm
by Boolsheet
raidho36 wrote:It actually quits gracefully rather than crashes it but doesn't leaves any kind of error message.
If the error happens before a window is created it won't bother making one just for the error message. However, it writes all error messages to stdout by default. That's easy to read on Linux and OS X, but because Microsoft did their own thing with the console, it's not very helpful if one doesn't know how to redirect it.

Re: Crash on open (Main)

Posted: Tue Jul 02, 2013 4:58 pm
by McMixx
Windows 7
HP
RAM: 4.00 (3.75 is usable)
System Type: 64-bit
Processor AMD Athlon(tm) II X2 260u Processor, 1800 Mhz, 2 Core(s), 2 Logical Processor(s)
ATI Radeon HD 4270