I've been holding my self back on writing this topic... but i didn't found anything that helped me (in Google and Forum Search).
Probably it already exists somewhere but i didn't managed to find it.
So.. i'm learning Lua and LÖVE and to acomplish that im working on the simplest kind of game first. The aim for the future of the game is damn high but the first low goal is to be an simple Q&A Bot.
By now i'm developing the UI.
So i managed to do this with my noob (artist that dont know an programmer) skills.
but my code couldn't handle this
interesting that it handles if i just type "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" to the end, but multiple letters it does not.
here it is.. my lame code don't hit me pls.
(i already took a look at game states and understand the logic, but im stil in my first steps into programming the game, so this code will adapt as i add more features and etc)
[edit]
Apparently i forgot to ask what i want heuheue sorry
i want an text box (not realy visible box) where the player is limited to 3 lines and the limit is about 500px width.
AND MOST IMPORTANT: I want to learn
i dont want anything done... I just want some path walk in.. because i couldn't find an tutorial and the UI library is confusing, since it have a lot of things that i don't want (so i can't find where exactly the thing happens).
[edit]
Code: Select all
function love.load()
love.success = love.window.setMode(800, 600, {borderless = true, centered = true})
pc_init = ":<>:"
player_console = ""
end
function love.update(dt)
pc_len = string.len(player_console)
end
function love.textinput(t)
player_console = player_console .. t
if pc_len == 90 then
player_console = player_console .. " "
elseif pc_len == 180 then
player_console = player_console .. " "
elseif pc_len == 270 then
love.keyboard.setTextInput(false)
elseif pc_len <= 269 then
love.keyboard.setTextInput(true)
end
end
function love.draw()
love.graphics.print(pc_init, 20, 500)
love.graphics.printf(player_console, 50, 500, 500, Right)
end
function love.keypressed(k)
if k == "escape" then
love.event.quit()
elseif k == "backspace" then
player_console = string.sub(player_console,1,-2)
end
end