Ejemplo n.º 1
0
 /// <summary>
 /// Draws the sprite of a gameobject
 /// </summary>
 /// <param name="rand"></param>
 /// <param name="spriteBatch"></param>
 /// <param name="camera">The active camera</param>
 public virtual void Draw(Point offset, Random rand, SpriteBatch spriteBatch, GraphicsDevice graphics, Camera camera, Color color)
 {
     if (sprite != "")
     {
         SpriteHandler.Draw(sprite, rand, spriteBatch, camera, new Vector2(position.X + offset.X, position.Y + offset.Y), new Vector2(1, 1), angle, Origin - position, color, 1f, SpriteEffects.None, 0.5f);
     }
 }
Ejemplo n.º 2
0
        public void Draw(Point offset, Random rand, SpriteBatch spriteBatch, Camera camera)
        {
            position += movement;
            angle    += rotation;
            switch (type)
            {
            case Type.idle:
                if (hp > 0)
                {
                    SpriteHandler.Draw(sprite, rand, spriteBatch, camera, position + offset.ToVector2() - new Vector2(SpriteHandler.sprites[sprite].width / 2 * scale, SpriteHandler.sprites[sprite].height / 2 * scale), scale, angle, position, color, 0f, SpriteEffects.None, 0.50f);
                }
                if (SpriteHandler.sprites[sprite].animationEnd)
                {
                    hp = 0;
                }
                break;

            case Type.text:
                hp--;
                spriteBatch.DrawString(font, text, position, color, angle, position, scale, SpriteEffects.None, 0.50f);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 3
0
 public void Draw(Random rand, SpriteBatch spriteBatch, Camera camera)
 {
     if (timer > 0)
     {
         SpriteHandler.Draw(sprite, rand, spriteBatch, camera, Vector2.Zero, 1f, 0f, Vector2.Zero, color, Opacity, SpriteEffects.None, 0);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Draws the light of a gameobject
 /// </summary>
 /// <param name="rand"></param>
 /// <param name="spriteBatch"></param>
 /// <param name="camera">The active camera</param>
 public virtual void DrawLight(Point offset, Random rand, SpriteBatch spriteBatch, Camera camera)
 {
     if (spriteLight != null)
     {
         SpriteHandler.Draw(spriteLight, rand, spriteBatch, camera, new Vector2(position.X + offset.X, position.Y + offset.Y), SpriteEffects.None, 0.5f);
     }
 }
Ejemplo n.º 5
0
        public override void Draw(Point offset, Random rand, SpriteBatch spriteBatch, GraphicsDevice graphics, Camera camera, Color color)
        {
            if (direction < 0)
            {
                spriteEffect = SpriteEffects.FlipHorizontally;
            }
            else
            {
                spriteEffect = SpriteEffects.None;
            }

            Vector2 drawPos = new Vector2(Origin.X - SpriteHandler.sprites[spr_idle].width / 2, Rectangle.Bottom - height) + textureOffset;

            rightHand.Draw(this, rand, spriteBatch, graphics, camera, false);
            switch (state)
            {
            case State.idle:
                SpriteHandler.Draw(spr_idle, rand, spriteBatch, camera, drawPos, 1f, 0f, Vector2.Zero, Color.White, 1, spriteEffect, 0.5f);
                break;

            case State.running:
                SpriteHandler.sprites[spr_running].speed = Math.Abs(movement.X) * .035f;
                SpriteHandler.Draw(spr_running, rand, spriteBatch, camera, drawPos, 1f, 0f, Vector2.Zero, Color.White, 1, spriteEffect, 0.5f);
                break;

            case State.dash:
                SpriteHandler.Draw(spr_dash, rand, spriteBatch, camera, drawPos, 1f, 0f, Vector2.Zero, Color.White, 1, spriteEffect, 0.5f);
                break;

            case State.back:
                SpriteHandler.Draw(spr_back, rand, spriteBatch, camera, drawPos, 1f, 0f, Vector2.Zero, Color.White, 1, spriteEffect, 0.5f);
                break;

            case State.jump:
                SpriteHandler.Draw(spr_jump, rand, spriteBatch, camera, drawPos, 1f, 0f, Vector2.Zero, Color.White, 1, spriteEffect, 0.5f);
                break;

            case State.fall:
                SpriteHandler.Draw(spr_fall, rand, spriteBatch, camera, drawPos, 1f, 0f, Vector2.Zero, Color.White, 1, spriteEffect, 0.5f);
                break;

            case State.stall:
                SpriteHandler.Draw(spr_stall, rand, spriteBatch, camera, drawPos, 1f, 0f, Vector2.Zero, Color.White, 1, spriteEffect, 0.5f);
                break;

            default:
                break;
            }

            leftHand.Draw(this, rand, spriteBatch, graphics, camera, true);
            if (SpriteHandler.sprites["Energy_lIdle"].currentFrame != SpriteHandler.sprites[spr_idle].currentFrame)
            {
                SpriteHandler.sprites["Energy_lIdle"].currentFrame = SpriteHandler.sprites[spr_idle].currentFrame;
            }
            if (SpriteHandler.sprites["Energy_rIdle"].currentFrame != SpriteHandler.sprites[spr_idle].currentFrame)
            {
                SpriteHandler.sprites["Energy_rIdle"].currentFrame = SpriteHandler.sprites[spr_idle].currentFrame;
            }
        }
Ejemplo n.º 6
0
 public void Draw(Point offset, Random rand, SpriteBatch spriteBatch, Camera camera)
 {
     if (direction > 0)
     {
         SpriteHandler.Draw("door_lamp", rand, spriteBatch, camera, new Vector2(offset.X + rectangle.Right - SpriteHandler.sprites["door_lamp"].width, offset.Y + rectangle.Y - 26), SpriteEffects.None, 0f);
     }
     else
     {
         SpriteHandler.Draw("door_lamp", rand, spriteBatch, camera, new Vector2(offset.X + rectangle.X, offset.Y + rectangle.Y - 26), SpriteEffects.FlipHorizontally, 0f);
     }
 }
Ejemplo n.º 7
0
 public override void Draw(Point offset, Random rand, SpriteBatch spriteBatch, GraphicsDevice graphics, Camera camera, Color color)
 {
     if (usePixel)
     {
         spriteBatch.Draw(pixel, position - new Vector2(size / 2, size / 2) + offset.ToVector2(), null, color * opacity, 0f, new Vector2(size / 2, size / 2), Scale, SpriteEffects.None, 0f);
     }
     else
     {
         SpriteHandler.Draw(sprite, rand, spriteBatch, camera, position - new Vector2(16 * Scale * .8f, 16 * Scale * .8f) + offset.ToVector2(), Scale * .8f, 0, Vector2.Zero, color, opacity, SpriteEffects.None, 0f);
     }
 }
Ejemplo n.º 8
0
 public override void Draw(Point offset, Random rand, SpriteBatch spriteBatch, Camera camera, float depth)
 {
     if (scale == 0)
     {
         SpriteHandler.Draw(spriteKey, rand, spriteBatch, camera, position, scaleVector2, angle, new Vector2(SpriteHandler.sprites[spriteKey].width / 2, SpriteHandler.sprites[spriteKey].height / 2), Color.White, 1f, SpriteEffects.None, depth);
     }
     else
     {
         SpriteHandler.Draw(spriteKey, rand, spriteBatch, camera, position, scale, angle, new Vector2(SpriteHandler.sprites[spriteKey].width / 2, SpriteHandler.sprites[spriteKey].height / 2), Color.White, 1f, SpriteEffects.None, depth);
     }
 }
Ejemplo n.º 9
0
 public override void Draw(Point offset, Random rand, SpriteBatch spriteBatch, Camera camera, float depth)
 {
     if (delay)
     {
         delay = false;
     }
     else
     {
         SpriteHandler.Draw(sprite, rand, spriteBatch, camera, position, scale, angle, origin, color, opacity, SpriteEffects.None, spriteNum);
     }
 }
Ejemplo n.º 10
0
 public override void Draw(Point offset, Random rand, SpriteBatch spriteBatch, GraphicsDevice graphics, Camera camera, Color color)
 {
     SpriteHandler.Draw(sprite, rand, spriteBatch, camera, new Vector2(position.X + Rectangle.Width / 2 + offset.X, position.Y + offset.Y + floatOffset), new Vector2(1, 1), angle, Origin - position, color, 1f, SpriteEffects.None, 0.5f);
 }
Ejemplo n.º 11
0
 public override void DrawLight(Point offset, Random rand, SpriteBatch spriteBatch, Camera camera)
 {
     SpriteHandler.Draw(spriteLight, rand, spriteBatch, camera, position - new Vector2(128 * Scale, 128 * Scale), Scale * 2, 0, Vector2.Zero, color, opacity * .6f, SpriteEffects.None, 0f);
 }
Ejemplo n.º 12
0
 public override void DrawLight(Point offset, Random rand, SpriteBatch spriteBatch, Camera camera)
 {
     SpriteHandler.Draw("gradient", rand, spriteBatch, camera, position, scaleLight, angle, new Vector2(128, 128), color, (timer / (startDuration * 1.2f)) * opacityLight, SpriteEffects.None, 0.5f);
 }
Ejemplo n.º 13
0
 public override void DrawLight(Point offset, Random rand, SpriteBatch spriteBatch, Camera camera)
 {
     SpriteHandler.Draw("gradient", rand, spriteBatch, camera, position, scale, 0, origin, color, opacityLight, SpriteEffects.None, 0);
 }