Game Development Reference
In-Depth Information
Figure 15.12 The texture used
is actually four copies of the
same texture in quadrants.
{
public var shine:Sprite;
public var texture:Sprite;
private var _vx:Number = 0;
private var _vy:Number = 0;
private var _textureOffsetX:Number;
private var _textureOffsetY:Number;
public function Marble()
{
_textureOffsetX = shine.width/2;
_textureOffsetY = shine.height/2;
}
)
are inside Sprites on the Stage. The shine also has cacheAsBitmap
turned on inside Flash though it could have just as easily been
enabled here in the code. The two-texture offset values represent
the coordinates at which the texture Sprite needs to have its posi-
tion reset. We
Both the texture and the three-dimensional effect (or
shine
'
ll use these in a moment.
override public function getRect(coordinateSpace:DisplayObject):
Rectangle
{
return shine.getRect(coordinateSpace);
}
One quirk of DisplayObjects in Flash is that even areas outside
of a mask count toward the calculated dimensions of an object.
Search Nedrilad ::




Custom Search