Text alignment reversed
tatiang
Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
Thought I'd share an odd issue in the unlikely event that someone else has this problem.
I'm using a loop to generate a text attribute by concatenating a bunch of table cells together like this: tableCellValue(Table,1,1).."\n"..tableCellValue(Table,2,1).."\n"..etc.
The problem is that if I use DisplayText to show the text attribute and I set the text alignment to left, it aligns the text with the right side of the actor instead. If I change the text alignment to right, it aligns the text with the left side of the actor.
It took me a long time but I finally figured out that the DisplayText -- while I think of it as a Constrain behavior -- was having trouble with an empty text attribute value at the beginning of the loop. If I put the DisplayText inside of a When self.Time>[time the loop takes to complete], it works as expected.
I'm using a loop to generate a text attribute by concatenating a bunch of table cells together like this: tableCellValue(Table,1,1).."\n"..tableCellValue(Table,2,1).."\n"..etc.
The problem is that if I use DisplayText to show the text attribute and I set the text alignment to left, it aligns the text with the right side of the actor instead. If I change the text alignment to right, it aligns the text with the left side of the actor.
It took me a long time but I finally figured out that the DisplayText -- while I think of it as a Constrain behavior -- was having trouble with an empty text attribute value at the beginning of the loop. If I put the DisplayText inside of a When self.Time>[time the loop takes to complete], it works as expected.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Comments
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If you try out the attached file, what happens is that the displayText actor on the right side waits 3 seconds and aligns the text correctly, but the displayText actor on the left side doesn't align things properly.
On a device -- oddly enough -- the WHOLE screen turns black when the displayText actor(s) fail to align correctly.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Hi @tatiang Yes, I did leave a comment but decided to delete it: it was a bit obvious a question asking if you were going to report the bug... ;-) (And a thumbs-up for spotting it).
Strange bug, I'll download your test file now to see it in action....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If you turn your device around... everything will be correct....
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
nope nope... to late.. I got here first!!!! [-X
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
8-X
It seems related to the timing of the DisplayText. If the DisplayText behavior triggers before the text string is fully generated, it presents a black box. If there's enough time before the behavior triggers, it displays correctly.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Going to try a slower looping function and see if that helps.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User