Esempio n. 1
0
        public void Draw(float deltaTime, SpriteBatch spriteBatch)
        {
            // Flip the sprite to face the way we are moving.
            if (velocity.X < 0)
            {
                heroSpriteEffects = SpriteEffects.FlipHorizontally;
            }
            else
            {
                heroSpriteEffects = SpriteEffects.None;
            }

            // Draw that sprite.
            Animator.Draw(deltaTime, spriteBatch, Position, heroSpriteEffects);

            if (invulnerabilityTimer.Running)
            {
                Game1.DrawRect(spriteBatch, BoundingRect);
            }

            // Draw Weapon Related things
            WeaponHandler.Draw(spriteBatch, position);
        }
Esempio n. 2
0
        public void LoadContent(ContentManager content)
        {
            //
            WeaponHandler.LoadContent(content);

            idle = new Animation(content.Load <Texture2D>("Sprites/Hero/2"), 1, 0.1f, true); // Just one frame
            diagonalDownRight = new Animation(content.Load <Texture2D>("Sprites/Hero/2_diagdown"), 4, 0.1f, true);
            diagonalUpRight   = new Animation(content.Load <Texture2D>("Sprites/Hero/2_diagup"), 4, 0.1f, true);
            up        = new Animation(content.Load <Texture2D>("Sprites/Hero/2_north"), 4, 0.1f, true);
            down      = new Animation(content.Load <Texture2D>("Sprites/Hero/2_south2"), 4, 0.1f, true);
            sideRight = new Animation(content.Load <Texture2D>("Sprites/Hero/2_side"), 4, 0.1f, true);

            // Calculate bounds within texture size.
            int width  = (int)(idle.FrameWidth);
            int left   = (idle.FrameWidth - width) / 2;
            int height = (int)(idle.FrameHeight);
            int top    = idle.FrameHeight - height;

            localBounds = new Rectangle(left, top, width, height);


            Reset();
        }
Esempio n. 3
0
 public void NextWeapon(eButtonState buttonState, Vector2 amount)
 {
     WeaponHandler.NextWeapon();
 }
Esempio n. 4
0
 public void PreviousWeapon(eButtonState buttonState, Vector2 amount)
 {
     WeaponHandler.PreviousWeapon();
 }