Jake Albano avatar Jake Albano committed 46227f5

Fixed vertical platform landing bug (sorry Chris! D: );

Comments (0)

Files changed (7)

obj/IfritConfig.old

     </define>
     <define append="true">
       <name>CONFIG::timeStamp</name>
-      <value>'10/31/2011'</value>
+      <value>'11/1/2011'</value>
     </define>
     <verbose-stacktraces>true</verbose-stacktraces>
     <source-path append="true">

obj/IfritConfig.xml

     </define>
     <define append="true">
       <name>CONFIG::timeStamp</name>
-      <value>'10/31/2011'</value>
+      <value>'11/1/2011'</value>
     </define>
     <verbose-stacktraces>true</verbose-stacktraces>
     <source-path append="true">

src/ifrit/Enemy.as

 			this.speed = Math.random();
 		}
 		
+		/**
+		 * 
+		 */
 		override public function think():void 
 		{
 			super.think();

src/ifrit/HorizontalWall.as

-package ifrit 
-{
-	import com.thaumaturgistgames.flakit.Library;
-	
-	import flash.display.Bitmap;
-	import flash.display.DisplayObject;
-	import flash.display.Sprite;
-	import flash.events.Event;
-	
-	
-	//TODO: block any and all objects
-	/*
-	 * Put all objects into an array and have each wall 
-	 * block every element in that object array
-	 */
-	public class HorizontalWall extends Sprite
-	{		
-		public var hWall:Bitmap = Library.IMG("horizontal.png");
-		public var hWallC:Sprite = new Sprite();
-		
-		private var obj:DisplayObject;
-		
-		public function HorizontalWall(object:DisplayObject, x:Number, y:Number, vertical:Boolean) 
-		{
-			addChild(hWallC);
-			
-			hWallC.x = hWall.x - (hWall.width / 2);
-			hWallC.y = hWall.y - (hWall.height / 2);
-			
-			this.x = x;
-			this.y = y;
-			
-			if (vertical) this.rotation = 90;
-			else this.rotation = 0;
-			
-			hWallC.addChild(hWall);
-			
-			obj = object;
-			
-			addEventListener(Event.ENTER_FRAME, enterFrame);
-		}
-		
-		private function enterFrame(e:Event):void 
-		{
-			var objHalfW:Number = obj.width / 2;
-			var objHalfH:Number = obj.height / 2;
-			var thisHalfW:Number = this.width / 2;
-			var thisHalfH:Number = this.height / 2;
-			
-			var dx:Number = this.x - obj.x; // Distance between objects (X)
-			var dy:Number = obj.y - this.y; // Distance between objects (Y)
-			
-			var ox:Number = (thisHalfW + objHalfW) - Math.abs(dx); // Overlap on X axis
-			var oy:Number = (thisHalfH + objHalfH) - Math.abs(dy); // Overlap on Y axis
-			
-			if (this.hitTestObject(obj))
-			{
-				if (this.rotation == 0)
-				{
-					if (obj.y < this.y) // top
-					{
-						obj.y -= oy;
-						Man.gravUp = false;
-						Man.jumpTimer.reset();
-					}
-					else if (obj.y > this.y) // bottom
-					{
-						Man.vy = 0;
-						obj.y += oy;
-					}
-					else if (obj.x <= this.x) obj.x -= ox; // left
-					else if (obj.x >= this.x) obj.x += ox; // right
-				}
-				else 
-				{
-					if (obj.x < this.x) obj.x -= ox; // left
-					else if (obj.x > this.x) obj.x += ox; // right
-					else if (obj.y <= this.y) // top
-					{
-						obj.y -= oy;
-						Man.gravUp = false;
-						Man.jumpTimer.reset();
-					}
-					else if (obj.y >= this.y) // bottom
-					{
-						obj.y += oy;
-						Man.vy = 0;
-					}
-				}
-			}
-			
-			//trace("obj x: " + obj.x);
-			//trace("obj y: " + obj.y);
-			//trace("ox: " + ox);
-			//trace("oy: " + oy);
-			//trace("dx: " + dx);
-			//trace("dy: " + Math.abs(dy));
-			//trace("objHalfW: " + objHalfW);
-			//trace("objHalfH: " + objHalfH);
-			//trace("thisHalfW: " + thisHalfW);
-			//trace("thisHalfH: " + thisHalfH);
-			//trace("this x: " + this.x);
-			//trace("this y: " + this.y);
-			//trace("----------------------");
-		} // end enter frame
-	}
-}
-
-//BUG: player forced down if touching >1 platform at a time
-/*
- * 
- */

src/ifrit/Man.as

-package ifrit 
-{
-	import com.thaumaturgistgames.flakit.Library;
-	
-	import flash.display.Sprite;
-	import flash.display.Bitmap;
-	import flash.events.Event;
-	import flash.utils.Timer;
-	
-	/**
-	 * ...
-	 * @author Chris Logsdon
-	 */
-	public class Man extends Sprite
-	{		
-		private var man:Bitmap = Library.IMG("rogue.png");
-		private var manC:Sprite = new Sprite;
-		
-		public static var vx:Number;
-		public static var vy:Number;
-		private var speedLimitX:Number;
-		private var speedLimitY:Number;
-		private var jumpSpeedLimit:Number;
-		
-		public static var gravity:Number;
-		
-		public static var L:Boolean;
-		public static var R:Boolean;
-		public static var SB:Boolean; // spacebar
-		
-		public static var jumpTimer:Timer = new Timer(0, 2);
-		
-		public static var gravUp:Boolean;
-		
-		public function Man(x:Number, y:Number) 
-		{
-			addChild(manC);
-			manC.x = man.x - (man.width / 2);
-			manC.y = man.y - (man.height / 2);
-			man.smoothing = true;
-			manC.addChild(man);
-			
-			this.x = x;
-			this.y = y;
-			
-			vx = 0;
-			vy = 0;
-			speedLimitX = 7;
-			speedLimitY = 20;
-			jumpSpeedLimit = 7;
-			gravity = 1;
-			
-			addEventListener(Event.ENTER_FRAME, onEnterFrame);
-		}
-		
-		
-		//BUG: Upward thrust when player hits corner of platform
-		private function onEnterFrame(e:Event):void
-		{
-			trace(vy);
-			
-			if (gravUp)	vy += gravity;
-			else vy = 0;
-			
-			// Jump(rise) until spacebar up or until timer ends.
-			if (SB && jumpTimer.currentCount < jumpTimer.repeatCount && vy <= 1)
-			{
-				if (!jumpTimer.running) {  jumpTimer.start();  }
-				
-				vy += -5;
-			}
-			if (jumpTimer.currentCount == jumpTimer.repeatCount) {  jumpTimer.stop();  }
-			
-			if (vx >= speedLimitX) {  vx = speedLimitX;  }
-			if (vx < -speedLimitX) {  vx = -speedLimitX;  }
-			if (vy >= speedLimitY) {  vy = speedLimitY;  }
-			if (vy < -jumpSpeedLimit) {  vy = -jumpSpeedLimit;  }
-			
-			// Apply physics to player movement
-			this.x += vx;
-			this.y += vy;
-			
-			// Stage boundaries
-			var thisHalfW:uint = (this.width / 2);
-			var thisHalfH:uint = (this.height / 2);
-			if (this.x + thisHalfW > stage.stageWidth)
-			{
-				this.x = stage.stageWidth - thisHalfW;
-				vx = 0;
-			}
-			if (this.x - thisHalfW < 0)
-			{
-				this.x = 0 + thisHalfW;
-				vx = 0;
-			}
-			if (this.y + thisHalfH > stage.stageHeight)
-			{
-				vy = 0;
-				this.y = stage.stageHeight - thisHalfH;
-				
-				jumpTimer.reset();
-			}
-			if (this.y - thisHalfH < 0)
-			{
-				vy = 0;
-				this.y = 0 + thisHalfH;
-			}
-			
-			gravUp = true;
-		} // End enter frame
-	}
-}
 		public var gravUp:Boolean;
 		public var jumping:Boolean;
 		public var jumpTimer:Timer = new Timer(0, 2);
-		protected var velocity:Point = new Point(0, 0);
+		public var velocity:Point = new Point(0, 0);
 		protected var speedLimit:Point;
 		
 		protected var halfSize:Point;

src/ifrit/Platform.as

 				}
 				else 
 				{
-					if (obj.x <= this.x) obj.x -= ox; // left
-					else if (obj.x >= this.x) obj.x += ox; // right
+					if (obj.x < this.x) obj.x -= ox; // left
+					else if (obj.x > this.x) obj.x += ox; // right
 					else if (obj.y <= this.y) // top
 					{
 						obj.y -= oy;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.