shape example: love.graphics.rectangle(mode, x, y, width, height)
use this to explain to me
how to make a shape disapear?
Re: how to make a shape disapear?
Every frame, the screen is cleared and you have to redraw everything that you want to be on the screen
If you want to make a shape disappear, don't draw it when you no longer want it to appear.
Here's an example to make a rectangle disappear at the end of a given time (4 seconds). When the timer expires, the 'if' condition is no longer true, and the rectangle is not drawn.
If you want to make a shape disappear, don't draw it when you no longer want it to appear.
Here's an example to make a rectangle disappear at the end of a given time (4 seconds). When the timer expires, the 'if' condition is no longer true, and the rectangle is not drawn.
Code: Select all
local disappear_time = 4
function love.update(dt)
if disappear_time > 0 then
disappear_time = disappear_time - dt
end
end
function love.draw()
if disappear_time > 0 then
love.graphics.rectangle("fill", 200, 200, 400, 200)
end
end
Re: how to make a shape disapear?
1. Make a list of objects.
2. Draw all objects from this list
3. Delete some objects from the list.
2. Draw all objects from this list
3. Delete some objects from the list.
-
- Prole
- Posts: 2
- Joined: Tue Sep 20, 2022 12:09 am
Re: how to make a shape disapear?
thanks pgimeno
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests