public static Entity GetRandomTree( ) { var anim = new SadConsole.Surfaces.Animated("default", 2, 2, EntityFont); anim.DefaultBackground = Color.Transparent; anim.DefaultForeground = Color.White; var frame = anim.CreateFrame(); frame.Cells[0].Glyph = 2; frame.Cells[1].Glyph = 255; frame.Cells[2].Glyph = 255; if (Program.Random.Next(10) > 3) { frame.Cells[0].Glyph = 2; frame.Cells[1].Glyph = 3; frame.Cells[2].Glyph = 18; frame.Cells[3].Glyph = 19; } else { frame.Cells[0].Glyph = 4; frame.Cells[1].Glyph = 5; frame.Cells[2].Glyph = 20; frame.Cells[3].Glyph = 21; } return(new SadConsole.Entities.Entity(anim)); //tree.Position = MapConsole.GetPointFromIndex( i ); }
public void OnStart( ) { // Delete all Children. Clears old EntityManager on a Restart Children.Clear(); EntityManager = new EntityManager(); Children.Add(EntityManager); // Redraw the board itself DefaultBackground = new Color(10, 10, 10); DefaultForeground = new Color(30, 30, 30); int DefaultGlyph = 260; Fill(DefaultForeground, DefaultBackground, DefaultGlyph); // Animated surface for Snake Head var _head = new SadConsole.Surfaces.Animated("default", 1, 1); _head.CreateFrame(); _head.Frames[0].SetGlyph(0, 0, 1); _head.Frames[0].SetForeground(0, 0, Color.LawnGreen); _head.Frames[0].SetBackground(0, 0, Color.TransparentBlack); // Create the Snake and Position to center of board Snake = new Snake(_head) { Position = new Point(Width / 2, Height / 2) }; PlaceTarget(); // Reset speed to default and Reset Timer _speed = _startSpeed; _timer = _speed; }