… and possibly Flash too. When testing the following code:
if ((e.target == _redMatcher && (_currentColour == "red" || _currentColour == "purple" || _currentColour == "yellow")) ||
(e.target == _greenMatcher && (_currentColour == "green" || _currentColour == "aqua" || _currentColour == "yellow")) ||
(e.target == _blueMatcher && (_currentColour == "blue" || _currentColour == "purple" || _currentColour == "aqua")))
{
trace("hello");
//SUCCESS
_comboBar.increase();
_txtCombo.text = "x" + _comboBar.combo;
var primaryColour:String = "";
if (e.target == _redMatcher && Colours.isSecondary(_currentColour))
primaryColour = "red";
else if (e.target == _greenMatcher && Colours.isSecondary(_currentColour))
primaryColour = "green";
else if (e.target == _blueMatcher && Colours.isSecondary(_currentColour))
primaryColour = "blue";
if (e.target == _redMatcher)
_redAbilityBar.increase();
else if (e.target == _greenMatcher)
_greenAbilityBar.increase();
else if (e.target == _blueMatcher)
_blueAbilityBar.increase();
...
The trace output to display “hello” does not show up. In the Flash target, the combo bar does correctly increase however, as expected, while the ability bars do not.
In the neko target, I am getting a completely different line, which is outside the scope of this function about 100 lines down. I am using a Tilesheet to draw and display graphics inside a class called AbilityBar. Is the Tilesheet the reason why the AbilityBar has its component sized to exponentially larger than what was intended (not to overlap the Matchers) or could it be the graphics component from Sprite.graphics?
I can’t tell yet.
The above image displays the current interface for the game. I just can’t quite get my head around this. Or maybe my Flash Player is for some reason not displaying the traces, because when you click on it you can see the results clearly… that combo bar does increase!
The function inside the AbilityBar for increase()
looks like this:
public function increase():Void
{
if (_currentChunk + 1 > _chunks)
_currentChunk = _chunks;
else
_currentChunk++;
trace(_currentChunk);
var value:Float = _currentChunk / _chunks;
var percent:Float = Utils.roundToNearest(10, value);
getAbilityState(Std.string(percent));
if (percent == 100)
_active = true;
}
private function getAbilityState(value:String):Void
{
_back.graphics.clear();
_abilityBar.drawTiles(_back.graphics, [0, 0, _map.get(value)]);
}
Changing the order at which the graphics are added to the stage does make a difference in neko in that the Matchers can now be interacted with, but that doesn’t really solve the Flash issue, nor the original, which is why these Ability Bars won’t increase in either target. I’m just confused at this point.
Anyone have any suggestions? Any help is appreciated.