User input

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
john
Prole
Posts: 4
Joined: Mon Oct 10, 2011 11:26 am

User input

Post 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.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: User input

Post 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
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: User input

Post 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.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Giapp and 9 guests