(Lua, Love2D) I have a method that prints one word, and then prints the next word. The word following the last is printed at a later "x" value, e.g. the first word is printed at X value 0, then next at X value 50. How do I determine how much to increase "X" by? [This is what happens when I linearly raise by a certain number.](https://love2d.org/imgmirrur/kkZVCSl.png) Here is my code.
while lineA[inthold2] == nil == false do
love.graphics.printf(lineA[inthold2], XLOC*ScaleX + int2, YLOC*ScaleY + int1, 1100, "left", 0, ScaleX, ScaleY)
XLOC = XLOC + 80
inthold2 = inthold2 + 1
end
lineA is an archive of strings. XLOC is the location. I know a for loop would be better but I wrote it as a while loop, I'm sorry.
Edit: The reason I am doing this instead of concatenating the strins is because I would like to have the middle word(s) of a line be coloured red, which can only be done, I believe, by printing each word individually and changing the colour to red before prting the specific words. If you can use this line of code:
love.graphics.printf(text2, 100*ScaleX + int2, 510*ScaleY + int1, 1100, "left", 0, ScaleX, ScaleY)
and change the colours of "text2", I would really like to know this. This is what I'm trying to get: http://i.snag.gy/56sOW.jpg but with proper formatting, namely, printing at the correct X value. Thank you for any help and also I know my code is a mess, I'm sorry.
Printing from an array.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 1
- Joined: Fri Mar 21, 2014 3:26 am
Printing from an array.
- Attachments
-
- Visual Novel.love
- (5.57 MiB) Downloaded 64 times
Who is online
Users browsing this forum: Google [Bot] and 3 guests