Hi everyone!
I am new to love2d but so far it's been great. I'm working on a word puzzle similar to scrambler in which I want to display scrambled text to the player and he/she needs to create as many correct words as possible. I am using loveframes to display letter tiles on the screen. In my first iteration I'm just working on hard coding some letter tiles and displaying them to the user. Now I want to check if the player is hitting words on the keyboard from the on-screen scrambled letters and display them in some placeholders on the screen. I'm getting really confused with love.textinput and love.keypressed. Can someone please help me out.
Thank you
Need help with a text based puzzle I'm working on
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Need help with a text based puzzle I'm working on
Could you please upload a .love for us? That way we can see what you're currently doing, and give better suggestions.
Help us help you: attach a .love.
Re: Need help with a text based puzzle I'm working on
Hi
I don't have much right now but this is what I was fiddling around with:
I am just trying to display some tiles with letters on the screen (using loveframes buttons here) and I just did as directed in the loveframes documentation. I know my code is really messy I am new to both lua and love2d so please bear with me. Thank you for your help.
I don't have much right now but this is what I was fiddling around with:
I am just trying to display some tiles with letters on the screen (using loveframes buttons here) and I just did as directed in the loveframes documentation. I know my code is really messy I am new to both lua and love2d so please bear with me. Thank you for your help.
Code: Select all
function love.load()
require("LoveFrames")
font = love.graphics.newFont(30)
love.graphics.setNewFont(30)
love.graphics.setBackgroundColor(0,204,102)
love.graphics.setColor(0,0,0)
text = ""
end
function love.draw()
Button()
loveframes.draw()
end
--Somewhere here I want to check if the user is entering the right letters from the tiles on the screen
--and check if it makes a correct word from a (hypothetical) dictionary. After she enters a word and presses enter I want to check if its a rightly guessed word
function love.textinput(t)
text = text .. t
if text == 'bad' then
correct = true
else
correct = false
end
loveframes.textinput(text)
end
--Drawing some test buttons here.( I want to have a table with all possible alphabets and loop over them to create my alphabet tiles)
function Button()
local button = loveframes.Create("button")
local button1 = loveframes.Create("button")
local button2 = loveframes.Create("button")
local button3 = loveframes.Create("button")
local button4 = loveframes.Create("button")
button.Draw = function(self)
button:SetSize(50,50):SetPos(100,100):SetText("A"):Center()
button1:SetSize(50,50):SetPos(200,100):SetText("B"):Center()
button2:SetSize(50,50):SetPos(300,100):SetText("C"):Center()
button3:SetSize(50,50):SetPos(400,100):SetText("D"):Center()
button4:SetSize(50,50):SetPos(500,100):SetText("E"):Center()
end
end
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests