Example #1
0
        public static Feather New(float xpos, float ypos, DuckPersona who)
        {
            if (who == null)
            {
                who = Persona.Duck1;
            }
            Feather feather;

            if (Feather._objects[Feather._lastActiveObject] == null)
            {
                feather = new Feather();
                Feather._objects[Feather._lastActiveObject] = feather;
            }
            else
            {
                feather = Feather._objects[Feather._lastActiveObject];
            }
            Level.Remove((Thing)feather);
            Feather._lastActiveObject = (Feather._lastActiveObject + 1) % Feather.kMaxObjects;
            feather.Init(xpos, ypos, who);
            feather.ResetProperties();
            feather._sprite.globalIndex = (int)Thing.GetGlobalIndex();
            feather.globalIndex         = Thing.GetGlobalIndex();
            return(feather);
        }
Example #2
0
 private void Init(float xpos, float ypos, DuckPersona who)
 {
     this.position.x = xpos;
     this.position.y = ypos;
     this.alpha      = 1f;
     this.hSpeed     = Rando.Float(6f) - 3f;
     this.vSpeed     = (float)((double)Rando.Float(2f) - 1.0 - 1.0);
     this._sprite    = who.featherSprite.CloneMap();
     this._sprite.SetAnimation("feather");
     this._sprite.frame = Rando.Int(3);
     if (Rando.Double() > 0.5)
     {
         this._sprite.flipH = true;
     }
     else
     {
         this._sprite.flipH = false;
     }
     this.graphic = (Sprite)this._sprite;
     this._rested = false;
 }