private void InitializeAnimations() { // Idle animation animIdle = new AnimatedConsole("default", 1, 1, Font); animIdle.CreateFrame().SetGlyph(0, 0, Font.Master.GetGlyphDefinition("Idle").Glyph); Animations.Add("Idle", animIdle); // Walk right animation animWalkRight = new AnimatedConsole("WalkRight", 1, 1, Font) { AnimationDuration = 0.5f, Repeat = true, }; foreach (GlyphDefinition glyphDef in Font.Master.ListGlyphDefinitions("WalkRight")) { Cell singleCell = animWalkRight.CreateFrame().Cells[0]; singleCell.Glyph = glyphDef.Glyph; singleCell.Mirror = glyphDef.Mirror; } Animations.Add("WalkRight", animWalkRight); animWalkLeft = new AnimatedConsole("WalkLeft", 1, 1, Font) { AnimationDuration = 0.5f, Repeat = true }; foreach (GlyphDefinition glyphDef in Font.Master.ListGlyphDefinitions("WalkRight", SpriteEffects.FlipHorizontally)) { Cell singleCell = animWalkLeft.CreateFrame().Cells[0]; singleCell.Glyph = glyphDef.Glyph; singleCell.Mirror = glyphDef.Mirror; } Animations.Add("WalkLeft", animWalkLeft); }
public EntityConsole() : base(80, 23) { var animation = new AnimatedConsole("default", 1, 1); var frame = animation.CreateFrame(); frame.Cells[0].Glyph = 1; player = new Entity(animation); player.Position = new Point(Width / 2, Height / 2); player.Components.Add(new SadConsole.Components.EntityViewSyncComponent()); playerPreviousPosition = player.Position; Children.Add(player); // Setup this console to accept keyboard input. UseKeyboard = true; IsVisible = false; }
public EntityConsole() : base(80, 23) { var animation = new AnimatedConsole("default", 1, 1); CellSurface frame = animation.CreateFrame(); frame.Cells[0].Glyph = 1; frame.SetDecorator(0, 2, new CellDecorator(Color.Yellow, 69, SpriteEffects.None)); player = new Entity(animation) { Position = new Point(Width / 2, Height / 2) }; player.Components.Add(new SadConsole.Components.EntityViewSyncComponent()); playerPreviousPosition = player.Position; Children.Add(player); // Setup this console to accept keyboard input. UseKeyboard = true; IsVisible = false; }