Page 1 of 1

draw(TextObject) won't update color of TextObject?

Posted: Tue Feb 14, 2017 3:28 am
by mitchist
Hi guys,

I'm having an issue whereby I want to conditionally change the color of some of the text in my ui, which is made up of TextObjects in a table, and drawn using a for loop. I'm not sure what's going wrong, but I suspect that either:

- love is only drawing the for loop once, not updating it regularly, so the changes to the TextObject variable aren't being drawn
- hump.timer is messing around with my conditional statement (though i implemented another way to change the color using a keypress rather than a conditional statement, so I don't think it's that)
- unknown

Any advice you have would be appreciated :) please find attached below the code I am using (apologies that it's zipped, it's the only away my internet would let me upload it). To find the bug, move the player using the arrow keys up onto the red "U" and press either "d" or "i". Either 'should' result in colors being changed somewhere.

Thanks in advance :)

Re: draw(TextObject) won't update color of TextObject?

Posted: Tue Feb 14, 2017 8:25 am
by Positive07
EDIT: Wrong thread! as zorg pointed out, sorry.

Also you should post a love file instead of a .zip so here you go
deep.space.love
(399.87 KiB) Downloaded 178 times
Now, I don't really get what the problem is, what should change color? how? when? I still haven't checked the code, but I got a ship and I could move around...

Re: draw(TextObject) won't update color of TextObject?

Posted: Tue Feb 14, 2017 8:41 am
by zorg
Positive07: Wrong thread, i reposted your answer over to the right one.

Re: draw(TextObject) won't update color of TextObject?

Posted: Tue Feb 14, 2017 9:32 am
by mitchist
Hi Positive07,

Basically, if you move the character onto the "U" and press d, on the right where it lists the systems, it should print the system status underneath each line in either red or green based on whether the status is online or offline. My issue is that love.draw() doesn't seem to be updating when i change the TextObject parameters in the right.lines table.

The code responsible is in ui.lua, around line 140.

Let me know if i can clarify any further 😊

Re: draw(TextObject) won't update color of TextObject?

Posted: Tue Feb 14, 2017 11:09 am
by Zireael
Mitchist, I tried to do some debugging in Zerobrane. The values looked ok so I tried to experiment a bit.

Getting rid of the wait thingy produced the following. So it's wait borking things up, plus it's drawing in the wrong place.
deep space test.png
deep space test.png (373.82 KiB) Viewed 3241 times