Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. if(enemy is walking right && hero is in the range of the enemy)
  2. { enemy walk towards player
  3. if(enemy touches player)
  4. {enemy attacks //enemies goes straight through the player and ends up on the left side of player}
  5.  
  6.  
  7. if(enemy is walking left && hero is in the range of the enemy)
  8. { enemy walk towards player
  9. if(enemy touches player)
  10. {enemy attacks //enemies goes straight through the player and ends up on the right t side of player}
  11.  
  12. for (var o:int = 0; o < aHellHoundArray.length; o++)
  13. {
  14. //var currentHound:HellHound = aHellHoundArray[o];
  15.  
  16. var hound:HellHound = aHellHoundArray[o];
  17.  
  18. hound.hellLoop();
  19. if (_character.x + 150 < hound.x && _character.x > hound.x - 600)
  20. {
  21. hound.moveLeft = true;
  22. hound.moveRight = false;
  23. }
  24. else
  25. if (_character.x + 50 < hound.x && _character.x > hound.x - 200 && rightKey || !rightKey)
  26. {
  27. hound.moveRight = false;
  28. hound.moveLeft = false;
  29. hound.attackLeft = true;
  30. trace("attack");
  31. }
  32. else
  33. {
  34. hound.attackLeft = false;
  35. }
  36.  
  37. /**
  38. * ...
  39. * @author Moynul Hussain
  40. */
  41. public class HellHound extends MovieClip
  42. {
  43. TweenPlugin.activate([BlurFilterPlugin]);
  44. public var movementSpeed:Number = 3;
  45. public var moveLeft:Boolean;
  46. public var moveRight:Boolean;
  47. public var attack:Boolean;
  48. public var attackLeft:Boolean;
  49. private var resetPos:Point;
  50. private var DashAmount:Number = 20;
  51. public function HellHound()
  52. {
  53. addEventListener(Event.ADDED_TO_STAGE, init)
  54. }
  55.  
  56. private function init(e:Event):void
  57. {
  58. removeEventListener(Event.ADDED_TO_STAGE, init);
  59. resetPos = new Point(x, y);
  60.  
  61. }
  62.  
  63. public function reset():void
  64. {
  65. x = resetPos.x;
  66. y = resetPos.y;
  67. }
  68.  
  69. public function hellLoop():void
  70. {
  71. if (attackLeft)
  72. {
  73. TweenMax.to(this, 0.25, { blurFilter: { blurX:20 }} );
  74. TweenMax.to(this, 1, { x:"-100" } );
  75. }
  76.  
  77. if (!attackLeft)
  78. {
  79. TweenMax.to(this, 0.5, { blurFilter: { blurX:0, blurY:0 }} );
  80. }
  81.  
  82. if (moveLeft)
  83. {
  84. this.x -= 2;
  85. this.scaleX = 1;
  86. this.gotoAndStop("run");
  87.  
  88. }
  89.  
  90.  
  91. if (moveRight)
  92. {
  93. this.x += 2;
  94. this.scaleX = -1;
  95. this.gotoAndStop("run");
  96. }
  97.  
  98. if (!moveLeft && !moveLeft && !attack)
  99. {
  100. // TweenLite.to(this,0,{blurFilter:{blurX:0}});
  101. // TweenLite.to(this,0,{blurFilter:{blurY:1000}});
  102. TweenMax.to(this, 0.5, { blurFilter: { blurX:0, blurY:0 }} );
  103. }
  104. }
  105.  
  106. public function dontMove():void
  107. {
  108. moveLeft = false;
  109. moveRight = false;
  110. }
  111.  
  112.  
  113.  
  114.  
  115. }
  116.  
  117. if (_character.x + 150 < hound.x && _character.x > hound.x - 600)
  118. {
  119. hound.moveLeft = true;
  120. hound.moveRight = false;
  121. }
  122. else
  123. if (_character.x + 50 < hound.x && _character.x > hound.x - 200 && rightKey || !rightKey)
  124. {
  125. hound.moveRight = false;
  126. hound.moveLeft = false;
  127. hound.attackLeft = true;
  128. trace("attack");
  129. }
  130. else
  131. {
  132. hound.attackLeft = false;
  133. }
  134.  
  135. if (attackLeft)
  136. {
  137. TweenMax.to(this, 0.25, { blurFilter: { blurX:20 }} );
  138. TweenMax.to(this, 1, { x:"-100" } );
  139. }
  140.  
  141. if (attackLeft)
  142. { ... }
  143.  
  144. if (!attackLeft)
  145. { ... }
  146.  
  147. if (attackLeft)
  148. { ... }
  149. else
  150. { ... }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement