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
Crash on open (Main)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Crash on open (Main)
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.
Defining xCloud and giving it a default value in load may help.
Re: Crash on open (Main)
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.
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)
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
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)
Shallow indentations.
Re: Crash on open (Main)
Thanks and it's a crash (crashes the whole thing), not a error.
Thanks (:
Thanks (:
Re: Crash on open (Main)
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.
With such simple code, we usually have to blame the graphics driver or other software that interferes with LÖVE.
Shallow indentations.
Re: Crash on open (Main)
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)
In one line you need to replace this:
by this:
and in the love.load you need to add this line:
However, not doing so should only result in an error (blue LÖVE-window with an error message), not a crash.
Code: Select all
xCloud = Cloud + 32*dt
Code: Select all
xCloud = xCloud + 32*dt
Code: Select all
xCloud = 0
Check out my blog on gamedev
Re: Crash on open (Main)
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.raidho36 wrote:It actually quits gracefully rather than crashes it but doesn't leaves any kind of error message.
Shallow indentations.
Re: Crash on open (Main)
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
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
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot] and 7 guests