Пример #1
0
 public GameObject(Vector2 pos, AnimatedSpriteSheet animSS)
     : this()
 {
     this.position = pos;
     this.aSS      = animSS;
     scaler        = 1.0f;
 }
Пример #2
0
        public void Initialize(Vector2 pos, float mass, Vector2 velocity,
                               int boundingBoxWidth, int boundingBoxHeight,
                               AnimatedSpriteSheet animSS, AnimationTexture animTex,
                               TimeSpan timeToLive, float scaler, Character owner)
        {
            this.position = pos;
            this.mass     = mass;
            this.velocity = velocity;
            if (animSS != null)
            {
                Vector2 temp = animSS.getBoundingBox();
                this.boundingBox.X      = (int)pos.X;
                this.boundingBox.Y      = (int)pos.Y;
                this.boundingBox.Width  = (int)(temp.X * scaler);
                this.boundingBox.Height = (int)(temp.Y * scaler);
                this.aSS = animSS;
            }
            else if (animTex != null)
            {
                Vector2 temp = animTex.getBoundingBox();
                this.boundingBox.X      = (int)pos.X;
                this.boundingBox.Y      = (int)pos.Y;
                this.boundingBox.Width  = (int)(temp.X * scaler);
                this.boundingBox.Height = (int)(temp.Y * scaler);
                this.aT = animTex;
            }

            this.isActive        = true;
            this.ttl             = timeToLive;
            this.scaler          = scaler;
            this.owner           = owner;
            this.currentRotation = MathHelper.ToRadians(random.Next(75));
            this.rotVal         += MathHelper.ToRadians(random.Next(7) + 1);
        }
Пример #3
0
 public Projectile(Vector2 pos, float mass, Vector2 velocity,
                   int boundingBoxWidth, int boundingBoxHeight,
                   AnimatedSpriteSheet animSS, TimeSpan timeToLive, float scaler)
     : base(pos, mass, velocity, boundingBoxWidth, boundingBoxHeight, animSS)
 {
     this.ttl   = timeToLive;
     this.owner = null;
 }
Пример #4
0
 public GameObject(Vector2 pos, AnimatedSpriteSheet animSS, float scaler) : this(pos, animSS)
 {
     this.scaler = scaler;
 }
 public InteractiveObject(Vector2 pos, float mass, Vector2 velocity, int boundingBoxWidth, int boundingBoxHeight, AnimatedSpriteSheet animSS, float scaler)
     : this(pos, mass, velocity, boundingBoxWidth, boundingBoxHeight, animSS)
 {
     this.scaler = scaler;
 }
        /* Don't think we need this, but i dunno so commented out
         *
         * public InteractiveObject(float mass, Vector2 velocity, int boundingBoxWidth, int boundingBoxHeight)
         * {
         *  this.position = new Vector2(0, 0);
         *  this.textureName = "NULL";
         *  this.mass = mass;
         *  this.velocity = velocity;
         *  this.boundingBox.X = 0;
         *  this.boundingBox.Y = 0;
         *  this.boundingBox.Width = boundingBoxWidth;
         *  this.boundingBox.Height = boundingBoxHeight;
         *  this.friction = 0.0f;
         *  this.fromSpriteSheet = false;
         *
         * }*/

        /// <summary>
        /// Good STUFF!
        /// Constructor for proper interactive objects frmo spritesheets.
        /// </summary>
        public InteractiveObject(Vector2 pos, float mass, Vector2 velocity, int boundingBoxWidth, int boundingBoxHeight, AnimatedSpriteSheet animSS)
            : base(pos, animSS)
        {
            construct(mass, velocity, boundingBoxWidth, boundingBoxHeight);
        }