Commits

Tao Chen  committed 314ecb0

camera and player bullet done

  • Participants
  • Parent commits 0ca9823

Comments (0)

Files changed (3)

File woot/BulletMan.as

 		static public var playerBullet : FlxGroup;
 		static public var enemyBullet : FlxGroup;
 		
+		private static var PLAYER_BULLET_SPEED : int = 350;
+		
 		static public function static_init() : void
 		{
 			playerBullet = new FlxGroup();
 				bullet = obj as Bullet;
 			}
 			
-			bullet.setup(0, dir, 200, player.x, player.y);
+			bullet.setup(0, dir, PLAYER_BULLET_SPEED, player.x + player.origin.x, player.y + player.origin.y);
 		}
 		
 		

File woot/PlayState.as

 			add(player1);
 			add(BulletMan.playerBullet);
 			add(BulletMan.enemyBullet);
-			
-			
+		
+			FlxG.camera.setBounds(0, 0, map.width, map.height, true);
+			FlxG.camera.follow(player1);
 			// DEBUG
 			FlxG.watch(BulletMan.playerBullet, "length");
 		}

File woot/Player.as

 	 */
 	public class Player extends FlxSprite 
 	{
-		static private var SPEED : int = 300;
+		static private var SPEED : int = 180;
 		static private var JUMP : int = 800;
+		static private var MAXSPEED_Y : int = 300;
 		
 		private var pid : uint;
 		//private var _handler : FlxControlHandler;
 			centerOffsets();
 			
 			acceleration.y = Comm.GRAVITY;
-			maxVelocity.y = SPEED;
+			maxVelocity.y = MAXSPEED_Y;
 			
 			allowCollisions = FlxObject.DOWN;
 		}
 				if (FlxG.mouse.justPressed())
 				{
 					var dir : uint;
-					var dx : Number = FlxG.mouse.screenX - x;
-					var dy : Number = FlxG.mouse.screenY - y;
+					var screenXY : FlxPoint = getScreenXY();
+					var dx : Number = FlxG.mouse.screenX - screenXY.x;
+					var dy : Number = FlxG.mouse.screenY - screenXY.y;
 					var deg : Number = Comm.rad2deg(Math.atan2(dy, dx));
 					FlxG.log(deg);
 					FlxG.log(Comm.deg2dir(deg));