Page 1 of 2
Lua show black screen when i run code
Posted: Thu Sep 08, 2022 4:56 pm
by MartinGarciaARG
Hi, im new at this, i started following a tutorial about LOVE using ZeroBrane Studio for editing. I started with the classic "Hello World", then i continue the tutorial drawing a rectangle, after that, adding code to move it, until this moment all worked ok, but then something happens, now every time i try to run this code again, LOVE only open the black screen showing nothing. Any suggestion about what could happens? . Thanks in advance.
Re: Lua show black screen when i run code
Posted: Thu Sep 08, 2022 7:59 pm
by milon
Can you post your .love file (or contents of main.lua)? What operating system are you running? What version of Love do you have installed?
Re: Lua show black screen when i run code
Posted: Thu Sep 08, 2022 9:50 pm
by knorke
MartinGarciaARG wrote: ↑Thu Sep 08, 2022 4:56 pmthen i continue the tutorial drawing a rectangle, after that, adding code to move it, until this moment all worked ok,
Maybe you moved the rectangle off-screen?
The usual approach when things do not work is to un-do the last changes until it somewhat works again. Then carefully do more changes and experiment.
But do post your code, otherwise we can only guess. But it feels like the error is more likely in your code rather than Love or OS.
Re: Lua show black screen when i run code
Posted: Fri Sep 09, 2022 4:04 am
by MartinGarciaARG
knorke wrote: ↑Thu Sep 08, 2022 9:50 pm
MartinGarciaARG wrote: ↑Thu Sep 08, 2022 4:56 pmthen i continue the tutorial drawing a rectangle, after that, adding code to move it, until this moment all worked ok,
Maybe you moved the rectangle off-screen?
The usual approach when things do not work is to un-do the last changes until it somewhat works again. Then carefully do more changes and experiment.
But do post your code, otherwise we can only guess. But it feels like the error is more likely in your code rather than Love or OS.
Hi, thanks for replying, yes , the idea of that tutorial is showing how you move that rectangle, and yes, it went off the screen the first time. But why if i re starting the code it seems appear off screen, it should start at the initial x,y position.
Re: Lua show black screen when i run code
Posted: Fri Sep 09, 2022 4:07 am
by MartinGarciaARG
milon wrote: ↑Thu Sep 08, 2022 7:59 pm
Can you post your .love file (or contents of main.lua)? What operating system are you running? What version of Love do you have installed?
Yes, the code is very simple, after the first time when it showed the rectangle moving and dissapearing off the screen, it stoped to work and now every time i run the code it opens the LOVE screen but dont show nothing.
Thanks.
Re: Lua show black screen when i run code
Posted: Fri Sep 09, 2022 4:09 am
by MartinGarciaARG
milon wrote: ↑Thu Sep 08, 2022 7:59 pm
Can you post your .love file (or contents of main.lua)? What operating system are you running? What version of Love do you have installed?
I have installed love-11.4-win64. And im running Windows10 Pro.
Re: Lua show black screen when i run code
Posted: Fri Sep 09, 2022 1:00 pm
by ReFreezed
There's nothing weird about the code. Restarting the game resets everything as expected.
Did you disable vsync by any chance? That would likely make the rectangle fly away very fast. To make the game frame rate independent use the delta time supplied to the update function:
Code: Select all
function love.update(dt)
x = x + 50*dt -- Move 50 pixels per second.
end
Re: Lua show black screen when i run code
Posted: Wed Sep 14, 2022 7:16 pm
by MartinGarciaARG
ReFreezed wrote: ↑Fri Sep 09, 2022 1:00 pm
There's nothing weird about the code. Restarting the game resets everything as expected.
Did you disable vsync by any chance? That would likely make the rectangle fly away very fast. To make the game frame rate independent use the delta time supplied to the update function:
Code: Select all
function love.update(dt)
x = x + 50*dt -- Move 50 pixels per second.
end
Yes, i tried that of delta time before but nothing seems to work, even if i put breakpoints in the code, when i run the programm in debug mode it never stop on thouse breakpoints.
Re: Lua show black screen when i run code
Posted: Wed Sep 14, 2022 8:16 pm
by BrotSagtMist
"draws nothing but the background"
Is this related to the other post:
viewtopic.php?f=3&t=93747&sid=cc9e1b026 ... 135c5da433 ?
Re: Lua show black screen when i run code
Posted: Thu Sep 15, 2022 2:47 pm
by milon
1. Try making a new project. Can you print/draw to the screen?
2. Try this as its own project:
Code: Select all
function love.mousepressed()
local r = love.math.random()
local g = love.math.random()
local b = love.math.random()
print(r, g, b)
love.graphics.setBackgroundColor(r, g, b)
end
Does the screen color change when you click in the window?