public Player(Map map) : base(map) { this.light = new PointLight { ShadowType = ShadowType.Occluded, Intensity = 0.8F }; map.Penumbra.Lights.Add(this.light); var tex = new UniformTextureAtlas(MlemGame.LoadContent <Texture2D>("Textures/Player"), 4, 4); this.animation = new SpriteAnimationGroup(); this.animation.Add(new SpriteAnimation(1, tex[0, 0]), () => this.Direction == Direction2.Down); this.animation.Add(new SpriteAnimation(1, tex[1, 0]), () => this.Direction == Direction2.Up); this.animation.Add(new SpriteAnimation(1, tex[2, 0]), () => this.Direction == Direction2.Left); this.animation.Add(new SpriteAnimation(1, tex[3, 0]), () => this.Direction == Direction2.Right); this.animation.Add(new SpriteAnimation(0.15F, tex[0, 0], tex[0, 1], tex[0, 2], tex[0, 3]), () => this.walkPercentage > 0 && this.Direction == Direction2.Down, 10); this.animation.Add(new SpriteAnimation(0.15F, tex[1, 0], tex[1, 1], tex[1, 2], tex[1, 3]), () => this.walkPercentage > 0 && this.Direction == Direction2.Up, 10); this.animation.Add(new SpriteAnimation(0.15F, tex[2, 0], tex[2, 1], tex[2, 2], tex[2, 3]), () => this.walkPercentage > 0 && this.Direction == Direction2.Left, 10); this.animation.Add(new SpriteAnimation(0.15F, tex[3, 0], tex[3, 1], tex[3, 2], tex[3, 3]), () => this.walkPercentage > 0 && this.Direction == Direction2.Right, 10); }
protected override void LoadContent() { base.LoadContent(); Textures = new UniformTextureAtlas(LoadContent <Texture2D>("Textures"), 8, 8); this.Camera = new Camera(this.GraphicsDevice) { AutoScaleWithScreen = true, Scale = 4 }; this.UiSystem.GlobalScale = 4; this.UiSystem.Add("Health", new Group(Anchor.TopLeft, Vector2.One, false)); this.Board = new Board(20, 10); new Jack(this.Board[3, 5], 0); new Jack(this.Board[8, 5], 1); for (var i = 0; i < 3; i++) { new MeleeTree(this.Board.RandomFreeTile()); } this.Gameplay = new Gameplay(this.Board, this.Camera); }