[solved] Making text based game. Problem with output.

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
BlackDiamondPL
Prole
Posts: 15
Joined: Tue Aug 08, 2017 8:38 pm

[solved] Making text based game. Problem with output.

Post by BlackDiamondPL »

Just starting so that's why i am making text based game.
What's the problem?
I have my text input and text history/output. Second one is what i need help with.
Everytime i press enter input text is checked and added to output table and yes i've done it using table and 'for' loop.
It works fine but i can't seem to change position of the output text.
  • First idea was to make it in big string. This could work fine but it would need clearing ALL TEXT.
  • Second idea was to insert a table with input text along with y cord. Question is how could i access this cord?
Last edited by BlackDiamondPL on Mon Aug 14, 2017 9:18 pm, edited 1 time in total.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Making text based game. Problem with output.

Post by grump »

You can change the position of printed text by altering the x and y arguments to the love.graphics.print function. Increase the y coordinate to put text farther down the screen.

For example:

Code: Select all

for index, line in ipairs(history) do
    love.graphics.print(line, 0, (index - 1) * love.graphics.getFont():getHeight())
end
BlackDiamondPL
Prole
Posts: 15
Joined: Tue Aug 08, 2017 8:38 pm

Re: Making text based game. Problem with output.

Post by BlackDiamondPL »

grump wrote: Mon Aug 14, 2017 8:53 pm You can change the position of printed text by altering the x and y arguments to the love.graphics.print function. Increase the y coordinate to put text farther down the screen.

For example:

Code: Select all

for index, line in ipairs(history) do
    love.graphics.print(line, 0, (index - 1) * love.graphics.getFont():getHeight())
end
Thank you very much ! :awesome:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 36 guests