noobs41bot Posted May 16, 2015 Share Posted May 16, 2015 Hello all! I am having some trouble updating a game object that exists in a loop. essentially what I am doing is when a collision event happens it calls the function which is working great. in that function I am testing a condition and that is also working great. but once I get into the loop where I am looping through a game group of bitmaptext items for some reason I am having trouble taking action on that item directly. see the code below. basically i get the console log that tells me i am on the right object, but the tint does not work, nor does the kill? I must be doing something very newbie'ish wrong, just not sure. I figured forcing and update would work but that didnt either. i get no errors but the item on the game does not get destroyed. Thanks in advance! createdLetters.forEach(function(_item){ if (_item.text == _letter.text) { //this._item.text.tint = 0x32CD32; _item.kill(); _item.update(); console.log("Found it"); } }, this); Link to comment Share on other sites More sharing options...
noobs41bot Posted May 16, 2015 Author Share Posted May 16, 2015 Nevermind.... it would help if i was looking at the right game group.... I must be tired. it works for killing it.... butttttttttttttt i still have the issue where i cannot change the tint? any help on the tint of bitmaptext would be awesome! i would think the following code would turn the bitmaptext green.... but it doesnt... _item.text.tint = 0x32CD32; Link to comment Share on other sites More sharing options...
Tom Atom Posted May 16, 2015 Share Posted May 16, 2015 Hi, instead of: _item.text.tint = 0x32CD32;try:_item.tint = 0x32CD32; Also, do not kill / update. Changing text sets internal value (dirty) to true (as well as tint does) and text is updated. If you need for some reason to know new text metrics like width and height immediately (before dirty is processed), then call updateText(); Link to comment Share on other sites More sharing options...
noobs41bot Posted May 17, 2015 Author Share Posted May 17, 2015 Awesome, Thanks! I'll give it a shot! Link to comment Share on other sites More sharing options...
Recommended Posts