/* A spawn point is a place where occasionally things spawn */ package { import flash.display.Sprite; public class spawnPoint extends Sprite { private var px, py:Number; // where we are private var theCounter:int; private var theFacing:int; private var theLimit:int; private var body:spawn_symb; // constructor; called once at beginning public function spawnPoint(startX:Number, startY:Number, lim:int) { px = startX; py = startY; if (Math.random()>0.5) { theFacing=1; } else { theFacing=2; } body = new spawn_symb(); x=0; y=0; body.x = px; body.y = py; addChild(body); theCounter = 0; theLimit = lim; } // call this once per frame // doesn't take care of collision results public function getX():Number { return px; } public function getY():Number { return py; } public function getFacing():int { return theFacing; } public function updater():Boolean { var turn:Number; turn = theCounter; turn = (turn/theLimit)*360.0; ++theCounter; body.rotation = turn; if (theCounter>=theLimit) { theCounter =0; return true; } else { return false; } } } }