using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using MLEM.Misc; using MLEM.Startup; using MLEM.Textures; namespace GreatSpringGameJam { public class Gnome : Entity { public Gnome(Map map, Vector2 position) : base(map, position) { } public override void Update(GameTime time) { if (GameImpl.Instance.Player.Bounds.Intersects(new RectangleF(this.Position, Vector2.One))) { MlemGame.LoadContent("Sounds/GnomeCollect").Play(); this.Map.RemoveEntity(this); } } public override void Draw(GameTime time, SpriteBatch batch) { base.Draw(time, batch); var tex = StuffTexture[1, 1]; var offset = new Vector2(0, MathF.Sin((float) time.TotalGameTime.TotalSeconds * 2) * 0.15F); var rotation = MathF.Sin((float) time.TotalGameTime.TotalSeconds * 1.5F) * 0.25F; batch.Draw(tex, this.Position * this.Map.TileSize + tex.Size.ToVector2() / 2 + offset * this.Map.TileSize, Color.White, rotation, tex.Size.ToVector2() / 2, 1, SpriteEffects.None, 1); } } }