Hello,
I'm trying to make a game where I have two characters, when the controlled character reaches a certain point an automatic dialog should appear between the two characters. These texts should appear for like 2 seconds for example and disappear after.
Can anyone point me in the direction on how to implement that?
I've attached the game file.
Thanks in advance!
Making a dialog. Drawing texts and removing them
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Making a dialog. Drawing texts and removing them
- Attachments
-
- game.love
- (5.62 KiB) Downloaded 110 times
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Making a dialog. Drawing texts and removing them
Welcome to the forum dado
To do that you'll need to code a timer or use a timer lib, cron.lua for exemple, and after X seconds the text would disappear, you can do that by making a variable that, when true, the game draws the text and when false it doesn't.
Here's an exemple using cron:
This code will make 'hello' appear on the screen for 2 seconds, after that the text will disappear.
You can also use text libs like this one
To do that you'll need to code a timer or use a timer lib, cron.lua for exemple, and after X seconds the text would disappear, you can do that by making a variable that, when true, the game draws the text and when false it doesn't.
Here's an exemple using cron:
Code: Select all
cron = require 'cron'
function love.load()
counter = cron.after(2,function() show = false end)
show = true
end
function love.update(dt)
counter:update(dt)
end
function love.draw()
if show then
love.graphics.draw('hello',1,1)
end
end
You can also use text libs like this one
Who is online
Users browsing this forum: No registered users and 10 guests