Lua show black screen when i run code
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 6
- Joined: Thu Sep 08, 2022 4:44 pm
Lua show black screen when i run code
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
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?
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Re: Lua show black screen when i run code
Maybe you moved the rectangle off-screen?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,
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.
-
- Prole
- Posts: 6
- Joined: Thu Sep 08, 2022 4:44 pm
Re: Lua show black screen when i run code
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.knorke wrote: ↑Thu Sep 08, 2022 9:50 pmMaybe you moved the rectangle off-screen?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,
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.
- Attachments
-
- main.lua
- (164 Bytes) Downloaded 87 times
-
- Prole
- Posts: 6
- Joined: Thu Sep 08, 2022 4:44 pm
Re: Lua show black screen when i run code
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.
- Attachments
-
- main.lua
- (164 Bytes) Downloaded 73 times
-
- Prole
- Posts: 6
- Joined: Thu Sep 08, 2022 4:44 pm
Re: Lua show black screen when i run code
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:
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
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
-
- Prole
- Posts: 6
- Joined: Thu Sep 08, 2022 4:44 pm
Re: Lua show black screen when i run code
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.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
- BrotSagtMist
- Party member
- Posts: 657
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Lua show black screen when i run code
"draws nothing but the background"
Is this related to the other post: viewtopic.php?f=3&t=93747&sid=cc9e1b026 ... 135c5da433 ?
Is this related to the other post: viewtopic.php?f=3&t=93747&sid=cc9e1b026 ... 135c5da433 ?
obey
Re: Lua show black screen when i run code
1. Try making a new project. Can you print/draw to the screen?
2. Try this as its own project:
Does the screen color change when you click in the window?
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
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Who is online
Users browsing this forum: Bing [Bot] and 2 guests