Game Development Reference
In-Depth Information
protected function getRandomColor():ColorTransform {
var red:Number = Math.random();
var green:Number = Math.random();
var blue:Number = Math.random();
var ct:ColorTransform = new ColorTransform(red,
green, blue, 1, 0, 0, 0, 0);
return ct;
}
public function get radius():Number {
return _radius;
}
public function get sides():int {
return _sides;
}
public function get depth():int {
return _depth;
}
public function get tunnelTiles():Array {
return _tunnelTiles;
}
public function highlightSide(angle:Number):void {
if (angle
0) angle = Math.PI*2 + angle;
var index:int = Math.round((angle * _sides)/(Math.PI * 2));
if (_highlightIndex == index) return;
for (var i:int = 0; i
<
_tunnelTiles.length; i++) {
if (_highlightIndex
<
= 0) _tunnelTiles[i]
[_highlightIndex].deactivate();
_tunnelTiles[i][index].activate();
>
}
_highlightIndex = index;
}
}
}
getRandomColor
You may have noticed that there is one method I didn
tdiscuss.Itisthe
getRandomColor method, and it does exactly the same. It returns a randomly
generated colorTransform object that can be applied. I created it as an
experiment when writing this class, and though it didn
'
tproducetheresultsI
was looking for, it is very interesting and might prove helpful if you want to
do something with colored tiles or any other type of color generation.
'
Search Nedrilad ::




Custom Search