text based game
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 5
- Joined: Sun Jul 18, 2010 5:08 am
text based game
I know love is more designed to make 2d games but can love be used to make text based games?
Re: text based game
Here's how I would do it:
And you know, it checks to see if text is a specific value...and then sets it back to "". So as a short answer: Yes, you can.
Code: Select all
text = ""
function keypressed(key)
text = text ..key
end
function love.draw()
love.graphics.drawText(text,400,300) --I KNOW ITS WRONG, JUST AN EXAMPLE.
end
-
- Prole
- Posts: 5
- Joined: Sun Jul 18, 2010 5:08 am
Re: text based game
text = ""
function keypressed(key)
text = text ..key
end
function love.draw()
love.graphics.drawText(text,400,300) --I KNOW ITS WRONG, JUST AN EXAMPLE.
end
Do I write it word for word or like this?
text = "You're in a castle"
function keypressed(1)
text = "You're in the throne room"
end
function love.draw()
love.graphics.drawText(text,400,300)
end
function keypressed(key)
text = text ..key
end
function love.draw()
love.graphics.drawText(text,400,300) --I KNOW ITS WRONG, JUST AN EXAMPLE.
end
Do I write it word for word or like this?
text = "You're in a castle"
function keypressed(1)
text = "You're in the throne room"
end
function love.draw()
love.graphics.drawText(text,400,300)
end
Re: text based game
Unless you want a retarded sentence generator, yes.
And I mean like for the text box, that was my example, and when they pressed the "enter" key, it would send and check. If not a valid answer, say so, and if so, would direct to the right place.
And I mean like for the text box, that was my example, and when they pressed the "enter" key, it would send and check. If not a valid answer, say so, and if so, would direct to the right place.
-
- Prole
- Posts: 5
- Joined: Sun Jul 18, 2010 5:08 am
Re: text based game
I inserted the text and made the .love file but when ever I open it, it just shows the love tank.
Re: text based game
That's how you shouldn't test an incomplete game. Put your script[s] in one folder, than drag that folder onto the LOVE.exe icon or the desktop shortcut.supertails wrote:I inserted the text and made the .love file but when ever I open it, it just shows the love tank.
-
- Prole
- Posts: 5
- Joined: Sun Jul 18, 2010 5:08 am
Re: text based game
I'm doing that on linux.
Re: text based game
Oh. Dang. Remember, my drawText thing was incorrect, and just an example. Look up on the wiki for the Hello World example to get an idea on how to ACTUALLY draw text.supertails wrote:I'm doing that on linux.
As for the tank, did you name your .lua file "main.lua"?
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: text based game
Text based games in LÖVE are very graphical, because you still have to worry about vertical and horizontal placement.
My advice is to get to know LÖVE and Lua better before attempting such a text based game.
My advice is to get to know LÖVE and Lua better before attempting such a text based game.
Help us help you: attach a .love.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: text based game
It seems kind of counter-intuitive to write a text-based game in Löve, when you could just write it in pure Lua and run it in a terminal. Though I guess you could show some pretty pictures to go along with it if you were using Löve.
Who is online
Users browsing this forum: Bing [Bot] and 5 guests