home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Esportes
/
CrossingCup.swf
/
scripts
/
__Packages
/
CArrow.as
< prev
next >
Wrap
Text File
|
2007-12-11
|
4KB
|
141 lines
class CArrow
{
var def_bx = 54.8;
var def_by = 0;
var def_bz = -38.5;
var upperlimit = -20;
var lowerlimit = -40;
var leftlimit = 20;
var rightlimit = 9;
function CArrow(bg, _mcParent)
{
this.mybg = bg;
this.mcParent = _mcParent;
this.tb = 3;
this.createArrow();
}
function createArrow()
{
var _loc5_ = new sandy.primitive.Plane3D(4,1,1,"tri");
this.mcArrow = this.mcParent.attachMovie("arrow","arrow",this.mcParent.getNextHighestDepth());
this.mcArrow._visible = false;
var _loc6_ = new sandy.skin.MovieSkin(this.mcArrow);
_loc5_.setSkin(_loc6_);
var _loc3_ = new sandy.core.group.TransformGroup();
var _loc2_ = new sandy.core.group.TransformGroup();
var _loc4_ = new sandy.core.group.TransformGroup();
this.rotation1 = new sandy.core.transform.Transform3D();
this.rotation2 = new sandy.core.transform.Transform3D();
this.translation = new sandy.core.transform.Transform3D();
this.rx = 0;
this.ry = 0;
this.rz = 0;
this.rotation1.rot(this.rx,this.ry,this.rz);
this.rotation2.rot(this.rx,this.ry,this.rz);
this.translation.translate(this.def_bx,this.def_by,this.def_bz);
_loc3_.setTransform(this.rotation1);
_loc2_.setTransform(this.rotation2);
_loc4_.setTransform(this.translation);
_loc3_.addChild(_loc5_);
_loc2_.addChild(_loc3_);
_loc4_.addChild(_loc2_);
this.mybg.addChild(_loc4_);
this.resetArrow();
}
function powering()
{
this.mcArrow.gotoAndPlay(2);
}
function ihatemath(sc, f1, f2, g1, g2)
{
return (sc - f1) / (f2 - f1) * (g2 - g1) + g1;
}
function unpowering()
{
var _loc2_ = this.rx;
var _loc5_ = this.mcArrow._currentframe;
var _loc9_ = 67;
var _loc7_ = 83;
var _loc8_ = 55;
var _loc6_ = 67;
var _loc3_ = this.ihatemath(_loc2_,this.upperlimit,this.lowerlimit,_loc9_,_loc8_);
var _loc4_ = this.ihatemath(_loc2_,this.upperlimit,this.lowerlimit,_loc7_,_loc6_);
this.power = this.ihatemath(_loc5_,0,20,_loc3_,_loc4_);
this.mcArrow.gotoAndStop(1);
}
function resetArrow()
{
this.rx = this.upperlimit;
this.ry = this.rightlimit;
this.rotation1.rotX(this.rx);
this.rotation2.rotY(this.ry);
}
function up()
{
this.rx += this.tb;
if(this.rx > this.upperlimit)
{
this.rx = this.upperlimit;
}
this.rotation1.rotX(this.rx);
}
function down()
{
this.rx -= this.tb;
if(this.rx < this.lowerlimit)
{
this.rx = this.lowerlimit;
}
this.rotation1.rotX(this.rx);
}
function left()
{
this.ry += this.tb;
if(this.ry > this.leftlimit)
{
this.ry = this.leftlimit;
}
this.rotation2.rotY(this.ry);
}
function right()
{
this.ry -= this.tb;
if(this.ry < this.rightlimit)
{
this.ry = this.rightlimit;
}
this.rotation2.rotY(this.ry);
}
function hide()
{
this.translation.translate(this.def_bx - 50,this.def_by,this.def_bz);
}
function show()
{
this.resetArrow();
this.translation.translate(this.def_bx,this.def_by,this.def_bz);
}
function randRange(min, max)
{
var _loc1_ = Math.floor(Math.random() * (max - min + 1)) + min;
return _loc1_;
}
function autoAim(pasti)
{
if(pasti)
{
this.mcArrow.gotoAndStop(8);
this.rx = -30;
this.ry = 18;
}
else
{
this.mcArrow.gotoAndStop(this.randRange(3,16));
this.rx = this.randRange(-20,-40);
this.ry = this.randRange(9,15);
}
this.rotation1.rotX(this.rx);
this.rotation2.rotY(this.ry);
}
}