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

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
mitchist
Prole
Posts: 2
Joined: Tue Feb 14, 2017 3:14 am

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

Post 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 :)
Attachments
deep.space.zip
(409.08 KiB) Downloaded 117 times
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

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

Post 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 168 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...
Last edited by Positive07 on Tue Feb 14, 2017 8:59 am, edited 1 time in total.
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
zorg
Party member
Posts: 3451
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post by zorg »

Positive07: Wrong thread, i reposted your answer over to the right one.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
mitchist
Prole
Posts: 2
Joined: Tue Feb 14, 2017 3:14 am

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

Post 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 😊
Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

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

Post 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 3135 times
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest