public ShipBlaster CreateBlaster(float x, float y, float radius, ObjectType type) { ShipBlaster bolt = new ShipBlaster(true); bolt.Position.X = x; bolt.Position.Y = y; bolt.Collider = PhysicsFactory.CreateCircleCollider(bolt.Position, radius); ((CircleCollider)bolt.Collider).Center.X = 1.5f; ((CircleCollider)bolt.Collider).Center.Y = 1.5f; return(bolt); }
public UObject CreateBolt(Vector2D position, float rotation, ref PlayerStatistics stats) { // Spawn blaster object ShipBlaster bolt = UniverseFactory.Instance.CreateBlaster(position.X + _firePos.X, position.Y + _firePos.Y, 3f, ObjectType.MISSLE); stats.WeaponDamage = 1.2f; stats.WeaponEnergyUse = 3.5f; //bolt.Position.X = Position.X + (_canon ? offset : Sprite.Frame.Width * Scale.X - offset); //_canon = !_canon; //bolt.Position.Y = Position.Y - 5.0f; float boltSpeed = -12.0f; bolt.Transform.Rotation.Angle = rotation; bolt.Velocity.Y = boltSpeed * (float)System.Math.Cos(rotation); bolt.Velocity.X = -boltSpeed * (float)System.Math.Sin(rotation); stats.Score -= 15; bolt.Damage = stats.Fire; return(bolt); }