我在敌人里面有一个影片剪辑(敌人)我有3个框架用于谜语,攻击和奔跑。敌人在Array里面。什么是将敌人和电影剪辑作为位图缓存到敌人内部的更好方法?
var greengoblinVelocity: int = 0;
var e: int;
for (e = numChildren - 1; e >= 0; e--)
{
var childdE: DisplayObject = getChildAt(e);
if (childdE.name.indexOf("enemy") > -1)
{
GreenGoblinArray.push(MovieClip(childdE));
MovieClip(childdE).hitPoints = 2;
MovieClip(childdE).currentX = 0;
MovieClip(childdE).startAttack = 0;
}
}
stage.addEventListener(Event.ENTER_FRAME, gameloop);
function gameloop(event: Event): void
{
for (var enl = 0; enl < GreenGoblinArray.length; enl++)
{
var enemy: Enemy = GreenGoblinArray[enl] as Enemy;
}
}
答案 0 :(得分:0)
CacheAsBitmap和cacheAsBitmapMatirx总是被吸引。您想要做的事情很少,而不是简单地绘制到位图。你使用什么渲染模式?那很重要