Permalink
Browse files

lots of shit i did.

  • Loading branch information...
1 parent 4d6b5f7 commit b87d86c022cacc60352f9c0449e5f26c4d317ca4 Deviantgeek committed Apr 22, 2012
@@ -1,23 +1,25 @@
package Enemies
{
- import org.flixel.FlxSprite;
+ import org.flixel.*;
/**
* ...
* @author Ricardo Mendes
*/
- public class Swarm extends FlxSprite
+ public class Swarm extends FlxEmitter
{
- public function Swarm()
+ public function Swarm(X:Number,Y:Number,Size:Number)
{
-
+ super();
}
- override public function create():void
+ override public function update():void
{
+ super.update();
+
}
}
@@ -0,0 +1,27 @@
+package Enemies
+{
+ import org.flixel.*;
+ /**
+ * ...
+ * @author Deviantgeek
+ */
+ public class Swarmlet extends FlxParticle
+ {
+ [Embed(source = "../data/swarm.png")]private var ImgSwarmlet:Class;
+ public function Swarmlet()
+ {
+ super();
+
+ loadGraphic(ImgSwarmlet);
+
+ exists = false;
+ }
+
+ override public function update():void
+ {
+
+ }
+
+ }
+
+}
@@ -0,0 +1,30 @@
+package
+{
+ import org.flixel.FlxSprite;
+ import org.flixel.FlxG;
+ /**
+ * ...
+ * @author Deviantgeek
+ */
+ public class Explosion extends FlxSprite
+ {
+ [Embed(source = "data/explosionsmedium-blue.png")]private var ImgAsplode:Class;
+
+ public function Explosion()
+ {
+ super(0, 0)
+ loadGraphic(ImgAsplode, true, false, 20, 20);
+ addAnimation("Dblue", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 40, false);
+ addAnimation("Lblue", [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], 40, false);
+ }
+
+ override public function update():void
+ {
+ FlxG.log("pre");
+ super.update();
+ FlxG.log("post");
+ play("Dblue");
+ }
+ }
+
+}
@@ -2,6 +2,7 @@ package
{
import org.flixel.*;
import Enemies.Enemy;
+ import org.flixel.plugin.photonstorm.BaseTypes.Bullet;
import org.flixel.plugin.photonstorm.FlxWeapon;
public class PlayState extends FlxState
@@ -15,6 +16,7 @@ package
protected var _bullets:FlxGroup;
protected var _gibs:FlxEmitter;
+ protected var _asplosions:FlxGroup;
private var _hud:HUD;
@@ -34,43 +36,60 @@ package
_cannon = new FlxWeapon("cannon", _player);
_cannon.makePixelBullet(20, 4, 4, 0xFF123456);
- _cannon.setBulletOffset(20,20);
+ _cannon.setBulletOffset(20, 20);
+ _cannon.setBulletLifeSpan(1000);
+ _cannon.onPreBulletKill = GrenadeBoom;
_cannon.setFireRate(1000);
add(_cannon.group);
add(_player);
_bullets = new FlxGroup();
- add(_bullets);
_follow = new Enemy();
_follow.init(20, 20, _bullets, _gibs, _player);
add(_follow);
+ add(_bullets);
+
+
+
+ _asplosions = new FlxGroup();
_hud = new HUD();
add(_hud);
FlxG.mouse.load(ImgCursor, 3);
FlxG.mouse.show();
-
- Registry.Fuel = 14;
}
override public function update():void
{
- if (FlxG.mouse.justPressed()) {
+ if (FlxG.mouse.justPressed())
+ {
_cannon.setBulletAcceleration(100, 100, 200, 200);
_cannon.setBulletSpeed( 100+FlxU.getDistance(_player.getMidpoint(), new FlxPoint(FlxG.mouse.x, FlxG.mouse.y)) );
_cannon.fireAtMouse();
+
}
+
super.update();
}
private function shrinkPlanet():void
{
_curPlanet.scale.x = _curPlanet.scale.y = .5;
}
+
+ public function GrenadeBoom():void
+ {
+ FlxG.log("yays");
+ //var boom:Explosion = _asplosions.recycle(Explosion) as Explosion;
+ var boom:Explosion = new Explosion;
+ FlxG.log(boom.x)
+ boom.x = (5);
+ boom.y = (5);
+ }
}
}
@@ -58,26 +58,30 @@ package
if(FlxG.keys.A || FlxG.keys.LEFT)
{
- if (this.x + 10 > 0) {
+ if (this.x + 10 > 0)
+ {
acceleration.x = -maxVelocity.x * 4;
}
}
else if(FlxG.keys.D || FlxG.keys.RIGHT)
{
- if (this.x + this.width - 10 < FlxG.width) {
+ if (this.x + this.width - 10 < FlxG.width)
+ {
acceleration.x = maxVelocity.x * 4;
}
}
if(FlxG.keys.W || FlxG.keys.UP)
{
- if (this.y + 10 > 0) {
+ if (this.y + 10 > 0)
+ {
acceleration.y = -maxVelocity.y * 4;
}
}
else if(FlxG.keys.S || FlxG.keys.DOWN)
{
- if (this.y + this.height - 10 < FlxG.height) {
+ if (this.y + this.height - 10 < FlxG.height)
+ {
acceleration.y = maxVelocity.y * 4;
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -218,6 +218,9 @@ package org.flixel.plugin.photonstorm.BaseTypes
{
if (lifespan > 0 && getTimer() > expiresTime)
{
+ if (weapon.onPreBulletKill is Function)
+ weapon.onPreBulletKill.apply();
+
kill();
}
@@ -89,6 +89,7 @@ package org.flixel.plugin.photonstorm
public var onPreFireCallback:Function;
public var onFireCallback:Function;
public var onPostFireCallback:Function;
+ public var onPreBulletKill:Function;
// Sounds
public var onPreFireSound:FlxSound;

0 comments on commit b87d86c

Please sign in to comment.