Permalink
Browse files

Made some small changes to gravity/jumpPower. Also improved BulletMan…

…ager

so more than one object can fire different bullet types from different
locations all at the same time in one group.
  • Loading branch information...
1 parent ec23550 commit b44cc8f19950205272ce67bba0a911d5fb7bc1da @hellocld committed Apr 13, 2012
View
Binary file not shown.
@@ -16,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
- <value>'4/11/2012'</value>
+ <value>'4/13/2012'</value>
</define>
<verbose-stacktraces>true</verbose-stacktraces>
<source-path append="true">
@@ -16,7 +16,7 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
- <value>'4/11/2012'</value>
+ <value>'4/13/2012'</value>
</define>
<verbose-stacktraces>true</verbose-stacktraces>
<source-path append="true">
View
@@ -19,7 +19,7 @@ package
FlxG.worldBounds.make(0, 0, 320, 240);
//set global gravity in the Registry
- Registry.gravity = 800;
+ Registry.gravity = 1600;
//huge bit of code here to create the room from the tilemap in the registry
Registry.tilemap = new FlxTilemap();
@@ -33,8 +33,8 @@ package
Registry.player.y = 64;
add(Registry.player);
- Registry.bullets = new BulletManager();
- add(Registry.bullets);
+ Registry.playerBullets = new BulletManager();
+ add(Registry.playerBullets);
}
override public function update():void
@@ -44,7 +44,7 @@ package
if (FlxG.keys.justPressed("Q")) FlxG.switchState(new MainMenu);
if (FlxG.keys.justPressed("R")) FlxG.resetState();
FlxG.collide(Registry.player, Registry.tilemap);
- FlxG.collide(Registry.bullets, Registry.tilemap);
+ FlxG.collide(Registry.playerBullets, Registry.tilemap);
}
}
View
@@ -40,7 +40,7 @@ package
add(Registry.npc);
//set up our player sprite
- Registry.player = new Player();
+ Registry.player = new ShootingPlayer();
Registry.player.x = 32;
Registry.player.y = 32;
add(Registry.player);
View
@@ -29,7 +29,7 @@ package
public static var npc:NPCgeneric;
//the player
- public static var player:Player;
+ public static var player:ShootingPlayer;
//a FlxGroup for the level, so all the other objects in the registry can "see" it (soon to be replaced by tilemap:FlxTilemap)
public static var level:FlxGroup;
@@ -39,7 +39,7 @@ package
public static var camera:FlxCamera;
//a bullet handler
- public static var bullets:BulletManager;
+ public static var playerBullets:BulletManager;
public function Registry()
{
@@ -29,6 +29,8 @@ package com.hellocld.player
super.update();
//player input stuffs
+
+ acceleration.x = 0;
if (FlxG.keys.LEFT)
{
velocity.x -= speed;
@@ -8,6 +8,7 @@ package com.hellocld.player
*/
public class ShootingPlayer extends Player
{
+
public function ShootingPlayer()
{
super();
@@ -16,10 +17,9 @@ package com.hellocld.player
override public function update():void
{
super.update();
-
if (FlxG.keys.justPressed("SPACE"))
{
- Registry.bullets.fire();
+ Registry.playerBullets.fire(this.x + width / 2, this.y + height / 2, 400);
}
}
@@ -20,12 +20,12 @@ package com.hellocld.projectile
}
}
- public function fire():void
+ public function fire(x:Number, y:Number, vel:Number):void
{
if (getFirstAvailable())
{
FlxG.log("FIRE");
- Bullet(getFirstAvailable()).fire(Registry.player.x, Registry.player.y, 400);
+ Bullet(getFirstAvailable()).fire(x, y, vel);
}
}

0 comments on commit b44cc8f

Please sign in to comment.