Actionscript 3 MovieClip赢得';不换框架
我在一个游戏中得到了一个墙的代码,如果它每25%的生命值(例如75%)是HP,它将改变框架 下面是墙的代码:Actionscript 3 MovieClip赢得';不换框架,actionscript-3,flash,movieclip,Actionscript 3,Flash,Movieclip,我在一个游戏中得到了一个墙的代码,如果它每25%的生命值(例如75%)是HP,它将改变框架 下面是墙的代码: protected function checkFrame() { if (Math.abs(this.currentDamageCounter) >= this.healthPrFrame) { if (this.currentDamageCounter > 0)
protected function checkFrame()
{
if (Math.abs(this.currentDamageCounter) >= this.healthPrFrame)
{
if (this.currentDamageCounter > 0)
{
trace("Working");
nextFrame();
this.dispatchEvent(new HeatShockEvent(HeatShockEvent.DATA_OUT));
this.currentDamageCounter -= this.healthPrFrame;
}
else
{
this.prevFrame();
this.currentDamageCounter += this.healthPrFrame;
}
checkFrame();
}
}
“工作”被追踪
另外,如果我转到构造器中的第2帧:
public function Wall()
{
this.gotoAndStop(2);
}
这会有用的
提前感谢:)什么是“nextFrame()”?什么是currentDamageCounter,什么是healtPrFrame?而且,我在任何地方都看不到任何百分比。我想你应该存储它的最大健康度,它的当前健康度,然后计算百分比。然后做不同百分比的事情