Page 1 of 1

User input

Posted: Mon Oct 10, 2011 11:53 am
by john
looking to make a very simple text based adventure with a gui and maybe some sounds/music

how would i go about getting using input and printing?

like:
print("what is your name?")
name = io.read()
print("hello"name)

but for love. all i have so far is

function love.draw()
love.graphics.print("what is your name?", 0, 0)
end

im not sure where to go from here.

Re: User input

Posted: Mon Oct 10, 2011 2:35 pm
by miko
john wrote:looking to make a very simple text based adventure with a gui and maybe some sounds/music

how would i go about getting using input and printing?

like:
print("what is your name?")
name = io.read()
print("hello"name)

but for love. all i have so far is

function love.draw()
love.graphics.print("what is your name?", 0, 0)
end

im not sure where to go from here.
You need to read SDL events, not the text console. So use love.keypressed.
Check out the tutorial:http://love2d.org/wiki/Tutorial:Callback_Functions

Re: User input

Posted: Mon Oct 10, 2011 2:56 pm
by Taehl
If all you want is a text-based game, why not just use Lua by itself? I've done it before, so I could help a bit if you want to go that way.