Permalink
Browse files

Primitive ball spawner

  • Loading branch information...
1 parent c2edac8 commit 556690faca95e83487e404d8c14df4e30125e845 @whitingjp committed Apr 21, 2012
Showing with 35 additions and 1 deletion.
  1. +34 −0 Src/Entity/BallSpawner.as
  2. +1 −1 Src/Tiles/TileMap.as
  3. BIN graphics/spritesheet.png
View
@@ -0,0 +1,34 @@
+package Src.Entity
+{
+ import mx.core.*;
+ import mx.collections.*;
+ import flash.geom.*
+ import flash.ui.Keyboard;
+ import flash.utils.Dictionary;
+ import Src.Tiles.*;
+ import Src.*;
+
+ public class BallSpawner extends Entity
+ {
+ public var collider:CCollider;
+ public function BallSpawner(pos:Point)
+ {
+ collider = new CCollider(this);
+ collider.elasticity = 0.7;
+ reset();
+ collider.pos = pos;
+ }
+
+ public function reset():void
+ {
+ collider.pos = new Point(0,0);
+ collider.speed = new Point(0,0);
+ }
+
+ public override function update():void
+ {
+ if(!game.entityManager.findEntityOfClass(Ball))
+ game.entityManager.push(new Ball(collider.pos));
+ }
+ }
+}
View
@@ -85,7 +85,7 @@ package Src.Tiles
game.entityManager.push(new MapAdvancer(p));
break;
case OBJ_BALL:
- game.entityManager.push(new Ball(p));
+ game.entityManager.push(new BallSpawner(p));
break;
case OBJ_SLUG:
game.entityManager.push(new Slug(p));
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 556690f

Please sign in to comment.