Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(enemy is walking right && hero is in the range of the enemy)
- { enemy walk towards player
- if(enemy touches player)
- {enemy attacks //enemies goes straight through the player and ends up on the left side of player}
- if(enemy is walking left && hero is in the range of the enemy)
- { enemy walk towards player
- if(enemy touches player)
- {enemy attacks //enemies goes straight through the player and ends up on the right t side of player}
- for (var o:int = 0; o < aHellHoundArray.length; o++)
- {
- //var currentHound:HellHound = aHellHoundArray[o];
- var hound:HellHound = aHellHoundArray[o];
- hound.hellLoop();
- if (_character.x + 150 < hound.x && _character.x > hound.x - 600)
- {
- hound.moveLeft = true;
- hound.moveRight = false;
- }
- else
- if (_character.x + 50 < hound.x && _character.x > hound.x - 200 && rightKey || !rightKey)
- {
- hound.moveRight = false;
- hound.moveLeft = false;
- hound.attackLeft = true;
- trace("attack");
- }
- else
- {
- hound.attackLeft = false;
- }
- /**
- * ...
- * @author Moynul Hussain
- */
- public class HellHound extends MovieClip
- {
- TweenPlugin.activate([BlurFilterPlugin]);
- public var movementSpeed:Number = 3;
- public var moveLeft:Boolean;
- public var moveRight:Boolean;
- public var attack:Boolean;
- public var attackLeft:Boolean;
- private var resetPos:Point;
- private var DashAmount:Number = 20;
- public function HellHound()
- {
- addEventListener(Event.ADDED_TO_STAGE, init)
- }
- private function init(e:Event):void
- {
- removeEventListener(Event.ADDED_TO_STAGE, init);
- resetPos = new Point(x, y);
- }
- public function reset():void
- {
- x = resetPos.x;
- y = resetPos.y;
- }
- public function hellLoop():void
- {
- if (attackLeft)
- {
- TweenMax.to(this, 0.25, { blurFilter: { blurX:20 }} );
- TweenMax.to(this, 1, { x:"-100" } );
- }
- if (!attackLeft)
- {
- TweenMax.to(this, 0.5, { blurFilter: { blurX:0, blurY:0 }} );
- }
- if (moveLeft)
- {
- this.x -= 2;
- this.scaleX = 1;
- this.gotoAndStop("run");
- }
- if (moveRight)
- {
- this.x += 2;
- this.scaleX = -1;
- this.gotoAndStop("run");
- }
- if (!moveLeft && !moveLeft && !attack)
- {
- // TweenLite.to(this,0,{blurFilter:{blurX:0}});
- // TweenLite.to(this,0,{blurFilter:{blurY:1000}});
- TweenMax.to(this, 0.5, { blurFilter: { blurX:0, blurY:0 }} );
- }
- }
- public function dontMove():void
- {
- moveLeft = false;
- moveRight = false;
- }
- }
- if (_character.x + 150 < hound.x && _character.x > hound.x - 600)
- {
- hound.moveLeft = true;
- hound.moveRight = false;
- }
- else
- if (_character.x + 50 < hound.x && _character.x > hound.x - 200 && rightKey || !rightKey)
- {
- hound.moveRight = false;
- hound.moveLeft = false;
- hound.attackLeft = true;
- trace("attack");
- }
- else
- {
- hound.attackLeft = false;
- }
- if (attackLeft)
- {
- TweenMax.to(this, 0.25, { blurFilter: { blurX:20 }} );
- TweenMax.to(this, 1, { x:"-100" } );
- }
- if (attackLeft)
- { ... }
- if (!attackLeft)
- { ... }
- if (attackLeft)
- { ... }
- else
- { ... }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement