Commits

Jake Albano  committed aa6fb3a

Added base class Projectile;
Added classes Fireball and Shuriken;
Changed default player animation to mage and default projectile to ball for testing purposes;

  • Participants
  • Parent commits 8fa0f11

Comments (0)

Files changed (5)

 		
 		public static var stage:Stage;
 		public static var man:Player;
-		public static var Projectiles:Vector.<Fireball>;
+		public static var Projectiles:Vector.<Projectile>;
 		public static var Mobs:Vector.<Mob>;
 		public static var Platforms:Vector.<Platform>;
 		
 			Input.init(stage);
 			
 			Platforms = new Vector.<Platform>;
-			Projectiles = new Vector.<Fireball>;
+			Projectiles = new Vector.<Projectile>;
 			Mobs = new Vector.<Mob>;
 			
 			Mobs.push(stage.addChild(man = new Player(50, 260)) as Mob);

File src/com/jacobalbano/Animation.as

 		private var frameDelay:uint = 0;
 		private var animation:Anim;
 		private var animations:Vector.<Anim> = new Vector.<Anim>;
-		private var frameWidth:Number;
-		private var frameHeight:Number;
+		private var _frameWidth:Number;
+		private var _frameHeight:Number;
 		private var _playing:String;
 		
 		/**
 			//	Set the buffer to update every frame
 			this.addEventListener(Event.ENTER_FRAME, runUpdate);
 			
-			this.frameWidth = width;
-			this.frameHeight = height;
+			this._frameWidth = width;
+			this._frameHeight = height;
 		}
 		
 		/**
 			}
 		}
 		
+		public function get frameWidth():int 	{	return this.frameWidth;		}
+		public function get frameHeight():int 	{	return this.frameHeight;	}
+		
 		/**
 		 * Internal enterFrame function
 		 */
 		 */
 		private function setRect():void 
 		{
-			this.buffer.copyPixels(storage, new Rectangle(this.animation.frames[this.frame] * this.frameWidth, 0, this.frameWidth, this.frameHeight), new Point);
+			this.buffer.copyPixels(storage, new Rectangle(this.animation.frames[this.frame] * this._frameWidth, 0, this._frameWidth, this._frameHeight), new Point);
 			this.graphics.clear();
 			
 			this.graphics.beginBitmapFill(buffer, null, false, false);
-			this.graphics.drawRect(0, 0, this.frameWidth, this.frameHeight);
+			this.graphics.drawRect(0, 0, this._frameWidth, this._frameHeight);
 			this.graphics.endFill();
 		}
 		

File src/ifrit/Fireball.as

 package ifrit 
 {
 	import com.thaumaturgistgames.flakit.Library;
-	import flash.display.BitmapData;
 	
-	import flash.display.Bitmap;
-	import flash.display.Sprite;
-	import flash.events.Event;
 	/**
-	 * ...
-	 * @author Chris Logsdon
+	 * @author Jake Albano
 	 */
-	public class Fireball extends Sprite
-	{		
-		public var fireball:Bitmap = Library.IMG("shuriken.png");
-		protected var fireballC:Sprite = new Sprite();
+	public class Fireball extends Projectile 
+	{
 		
-		private var dx:int;
-		private var vy:Number;
-		
-		public var friendly:Boolean;
-		
-		public function Fireball(direction:int, x:Number, y:Number, friendly:Boolean = true) 
+		public function Fireball(direction:int, x:Number, y:Number, friendly:Boolean = true)
 		{
-			addChild(fireballC);
-			
-			fireballC.x = fireball.x - (fireball.width / 2);
-			fireballC.y = fireball.y - (fireball.height / 2);
-			
-			fireballC.addChild(fireball);
-			
-			dx = direction;
-			this.x = x;
-			this.y = y;
-			
-			vy = 0;
-			this.friendly = friendly;
-			
-			addEventListener(Event.ENTER_FRAME, enterFrame);
-		}
-		
-		public function destroy():void
-		{
-			removeEventListener(Event.ENTER_FRAME, enterFrame);
-		}
-		
-		private function enterFrame(e:Event):void 
-		{
-			this.vy += 0.02;
-			this.y += this.vy;
-			
-			/**
-			 * Debugging information; displays trajectory
-			 * Uncomment the lines below to see in action
-			 */
-			//var bmp:Bitmap = new Bitmap(new BitmapData(10, 1, false, 0xff0000));
-			//bmp.x = this.x;
-			//bmp.y = this.y;
-			//Game.stage.addChild(bmp);
-			
-			this.x += dx;
-			if (dx < 0) { this.rotation -= 20; }
-			else if (dx > 0) { this.rotation += 20; }
+			super(Library.IMG("fireballShot.png"), 25, 10, direction, x, y, friendly);
+			this.animation.add("fly", [0, 1], 7, true);
+			this.animation.play("fly");
 		}
 		
 	}

File src/ifrit/Mob.as

 		public var maxHealth:uint;
 		
 		public function Mob(x:Number, y:Number, bitmap:Bitmap, frameWidth:Number, frameHeight:Number) 
-		{
-			//super(bitmap, frameWidth, frameHeight);
-			
-			//this.bitmap = bitmap;
-			
+		{			
 			this.container = new Sprite;
 			addChild(container);
 			graphic = new Animation(bitmap, frameWidth, frameHeight);

File src/ifrit/Player.as

 	{		
 		public function Player(x:Number, y:Number) 
 		{
-			super( x, y, Library.IMG("fighterAtkWalk.png"), 38, 33 );
+			super( x, y, Library.IMG("mageAtkWalk.png"), 18, 25 );
 			this.friendly = true;
 		}