home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Aventura
/
pendekar.swf
/
scripts
/
DefineSprite_266_eJagoan01
/
frame_1
/
DoAction.as
Wrap
Text File
|
2006-05-08
|
3KB
|
139 lines
function init()
{
if(runOnce)
{
return undefined;
}
this.runOnce = true;
this.hp = 300;
this.dir = 1;
if(_root.difficulty == "easy")
{
this.power = 12;
}
else
{
this.power = 20;
}
this.mobility = 50;
if(_root.difficulty == "easy")
{
this.skill = 15;
}
else
{
this.skill = 30;
}
this.hitable = true;
this.action = true;
this.level = _Y;
this.nLevel = _Y;
this.charName = "Jagoan Kampung";
this.attachMovie("oJagoanAI","AI",1);
if(intro)
{
intro = false;
gotoAndStop(35);
action = false;
hitable = false;
}
}
function idle()
{
gotoAndStop(1);
}
function moveRight()
{
speed = !duck ? 10 : 6;
if(dir < 0)
{
_X = !duck ? _X - 59 : _X - 30;
_xscale = _xscale * -1;
}
dir = 1;
gotoAndStop(!duck ? "eJagoan01Run" : "eJagoan01Walk");
}
function moveLeft()
{
speed = !duck ? 10 : 6;
if(dir > 0)
{
_X = !duck ? _X + 59 : _X + 30;
_xscale = _xscale * -1;
}
dir = -1;
gotoAndStop(!duck ? "eJagoan01Run" : "eJagoan01Walk");
}
function attCombo(number)
{
if(number == undefined)
{
trace("err: Combo number undefined!");
return undefined;
}
gotoAndStop("eJagoan01Attack0" + number);
}
function inStage()
{
if(_parent.isScroll)
{
if(dir == 1 && _X + 50 < Stage.width / 2)
{
return true;
}
if(dir == -1 && _X - 50 > 0)
{
return true;
}
return false;
}
if(dir == 1 && _X + 50 < Stage.width)
{
return true;
}
if(dir == -1 && _X - 50 > 0)
{
return true;
}
return false;
}
function dirValue(number)
{
return dir * number;
}
function getHit(power, hard, player)
{
this.hitter = player;
if(power == undefined)
{
trace("err: Hit power undefined!");
power = 0;
}
r = random(100) + 1;
if(hp - power >= 0)
{
if(r > skill)
{
hp -= power;
if(_Y >= nLevel)
{
gotoAndStop(!hard ? "eJagoan01Hit01" : "eJagoan01Hit02");
}
else
{
gotoAndStop(_Y >= nLevel ? "eJagoan01Hit01" : "eJagoan01Hit02");
}
}
else
{
gotoAndStop(36);
}
}
else
{
gotoAndStop(34);
}
}
this.onLoad = init();
stop();