Actionscript 3 动作脚本3。如何制作角色的阴影底部?

Actionscript 3 动作脚本3。如何制作角色的阴影底部?,actionscript-3,flash,animation,actionscript,shadow,Actionscript 3,Flash,Animation,Actionscript,Shadow,我正在制作flash游戏,我需要在角色和敌人的底部制作阴影。这里有大约35个动画,每个都有大约100帧。所以编辑每一帧并绘制阴影是不可能的 我的角色的名字是英雄和敌人。我需要这样做,总是底部的英雄和敌人的阴影将显示(阴影可以是圆形或等)。就在跳跃时,它应该重新调整大小(当角色/敌人在空中时,阴影应该更暗、更小) 有可能做出这样的事情吗 这就是我宣布敌人的方式: public var Enemy:Priesas = new Priesas; //Priesas is instance name o

我正在制作flash游戏,我需要在角色和敌人的底部制作阴影。这里有大约35个动画,每个都有大约100帧。所以编辑每一帧并绘制阴影是不可能的

我的角色的名字是英雄和敌人。我需要这样做,总是底部的英雄和敌人的阴影将显示(阴影可以是圆形或等)。就在跳跃时,它应该重新调整大小(当角色/敌人在空中时,阴影应该更暗、更小)

有可能做出这样的事情吗

这就是我宣布敌人的方式:

public var Enemy:Priesas = new Priesas; //Priesas is instance name of Enemy
英雄模板正在通过单击按钮进行选择:

public function selectHero(what:int):void {
    // this is called with correct "what", design yourself. I use array index
    var whatHero:Class = heroes[what]; // get selected hero symbol
    if (Hero && Hero.parent) Hero.parent.removeChild(Hero);
    // clean up previous hero. Drop listeners here, if any
    Hero = new whatHero(); // get new hero
    // process as usual, don't forget to "addChild(Hero)" somewhere
    create_hero();
}

    function choosePlayer(event:MouseEvent):void {
        selectHero(0); // here is set first template for my Hero
        start(event);
        }

     function create_hero()
     {
        addChild(Hero);
     }
因此,声明的变量是:
Hero
敌军

这是如何为角色英雄设置动画的最简单代码:

if (attack1)
{
            enterFrameHandler();
    Hero.gotoAndStop("attack1");

}

我不知道是否有足够的信息给你,你能帮我吗?

创建一个电影唇“影子”,它是你想要的任何形状的影子。 创建另一个电影剪辑“HeroWithShadow”,它将包含你的英雄和影子

public function selectHero(what:int):void {
    // this is called with correct "what", design yourself. I use array index
    var whatHero:Class = heroes[what]; // get selected hero symbol
    if (Hero && Hero.parent) Hero.parent.removeChild(Hero);
    // clean up previous hero. Drop listeners here, if any
    Hero = new whatHero(); // get new hero
    // process as usual, don't forget to "addChild(Hero)" somewhere
    create_hero();
}

function choosePlayer(event:MouseEvent):void {
    selectHero(0); // here is set first template for my Hero
    start(event);
}

function create_hero(){
    //create shadow
    var shadow:Shadow = new Shadow();
    //create container that will hold both hero and shadow
    var heroWithShadow:HeroWithShadow = new HeroWithShadow();
    //add both hero and shadow on heroWithShadow
    heroWithShadow.addChild(Hero);
    heroWithShadow.addChild(shadow);
    //bring shadow to the bottom of hero
    shadow.y = Hero.height;
    addChild(heroWithShadow);
}
请注意,如果您想水平移动英雄(行走),则更新“heroWithShadow.x”;如果您想垂直移动英雄(跳跃),则更新“hero.y” 让我知道这是否有效