Commits

Jake Albano  committed 2cd6544

Cleaned up merged code to support the features introduced in my last commit;

  • Participants
  • Parent commits 3bf7f03

Comments (0)

Files changed (2)

File src/ifrit/Enemy.as

 			super.think();
 			this.rotationY = this.heading ? 0 : 180;
 			
+			var found:Boolean = false;
 			for (var i:int = 0; i < Game.Platforms.length; i++) 
 			{
 				if (Game.Platforms[i].collide(this))
 				{
 					leftBound = Game.Platforms[i].x + this.width / 2 - Game.Platforms[i].width / 2;
 					rightBound = Game.Platforms[i].x - this.width / 2 + Game.Platforms[i].width / 2;
+					found = true;
 				}
 			}
 			
+			if (!found)
+			{
+				this.leftBound = 0;
+				this.rightBound = stage.stageWidth;
+			}
+			
 			if (this.x == this.lastPosition.x) heading = !heading;
 			else if (this.x >= this.rightBound) heading = false;
 			else if (this.x <= this.leftBound) heading = true;

File src/ifrit/Mob.as

 		public var jumping:Boolean;
 		public var jumpTimer:Timer = new Timer(0, 2);
 		protected var velocity:Point = new Point(0, 0);
-		protected var speedLimit:Number;
+		protected var speedLimit:Point;
 		
 		protected var halfSize:Point;
 		
 			
 			this.halfSize = new Point(this.width / 2, this.height / 2);
 			
-			speedLimit = 7;
+			speedLimit = new Point(7, 20);
 			
 			addEventListener(Event.ENTER_FRAME, onEnterFrame);
 		}
 				
 				velocity.y += -5;
 				
-				if (velocity.x >= speedLimit) {	velocity.x = speedLimit; }
-				if (velocity.x < -speedLimit) {	velocity.x = -speedLimit; }
-				if (velocity.y >= speedLimit) {	velocity.y = speedLimit; }
-				if (velocity.y < -speedLimit) {	velocity.y = -speedLimit; }
+				if (velocity.x >= speedLimit.x) {	velocity.x = speedLimit.x; }
+				if (velocity.x < -speedLimit.x) {	velocity.x = -speedLimit.x; }
+				if (velocity.y >= speedLimit.y) {	velocity.y = speedLimit.y; }
+				if (velocity.y < -speedLimit.x) {	velocity.y = -speedLimit.x; }
 				
 			}