/// <summary> /// Draws the character, moving it towards the player. /// </summary> /// <param name="playerRow">The player row.</param> /// <param name="playerCol">The player col.</param> public void Draw(int playerRow, int playerCol) { var path = _mazeSolver.Solve( Col, Row, playerCol, playerRow); var nextMove = FindParent(path); _speccyEngine.Pen = Colors.DodgerBlue; _speccyEngine.Print(Row, Col, " "); Row = nextMove.Y; Col = nextMove.X; _speccyEngine.Print(Row, Col, "¬a"); //_speccyEngine.Paper = Colors.Transparent; //var start = true; //while (path != null) //{ // _speccyEngine.Pen = start ? Colors.Yellow : Colors.Red; // _speccyEngine.Print(path.Y, path.X, "+"); // path = path.Parent; // start = false; //} }
public void Draw() { _speccy.Print(_row, Col - 1, " "); // Handle keypress (remember the "ship" is three characters wide). if (_speccy.LastKeyPress == Key.Left && Col > 1) { Col--; } else if (_speccy.LastKeyPress == Key.Right && Col < 58) { Col++; } else if (_speccy.LastKeyPress == Key.Space && Missile == null) { // Launch a new missile if there isn't already one in flight. Missile = new PlayerMissile(_speccy, _row, Col); } _speccy.Pen = Colors.Cyan; _speccy.Print(_row, Col - 1, "¬J¬K¬I"); Missile?.Draw(); if (Missile?.Row == -1) { Missile = null; } }
public void Draw() { if (Row < 0) { return; } _speccy.Print(Row, Col, " "); Row--; _speccy.Pen = Colors.Orange; _speccy.Print(Row, Col, "*"); }
public void Draw() { if (Row >= 39) { return; } _speccy.Print(Row, Col, " "); Row++; _speccy.Pen = Colors.Red; _speccy.Print(Row, Col, "o"); }
/// <summary> /// Draws the bomb/explosion. /// </summary> /// <param name="playerRow">The player row.</param> /// <param name="playerCol">The player col.</param> /// <param name="guards">The guards.</param> /// <param name="score">The score.</param> public void Draw( int playerRow, int playerCol, List <SecurityGuard> guards, ref int score) { if (ExplosionFinished) { return; } if (Detonated) { DrawExplosion( playerRow, playerCol, guards, ref score); } else { var countdown = _detonationTime.Subtract(DateTime.Now).TotalSeconds; _speccyEngine.Paper = Colors.Blue; _speccyEngine.Pen = Colors.OrangeRed; _speccyEngine.Flash = true; _speccyEngine.Print(0, 2, $"Countdown: {countdown:F0}"); _speccyEngine.Paper = Colors.Yellow; _speccyEngine.Print(_row, _col, "*"); _speccyEngine.Flash = false; if (DateTime.Now >= _detonationTime) { _speccyEngine.Paper = Colors.Blue; _speccyEngine.Print(0, 2, " "); Detonated = true; } } }
public void Draw() { _speccy.Paper = Colors.Black; _speccy.Pen = Colors.Red; _rotateStart++; if (_rotateStart == SpeccyEngine.ScreenCols) { _rotateStart = 0; } var i = _rotateStart; for (var col = 0; col < SpeccyEngine.ScreenCols; col++) { switch (_forceField[i]) { case BlockStrength.Normal: _speccy.Print(_row, col, NormalBlockGlyph); break; case BlockStrength.Missing: _speccy.Print(_row, col, MissingBlockGlyph); break; case BlockStrength.Unbreakable: _speccy.Print(_row, col, UnbreakableBlockGlyph); break; } i++; if (i == _forceField.Length) { i = 0; } } }
public void Draw() { var startRow = _firstRow; for (var row = 0; row < _blockData.GetLength(0); row++) { for (var col = 0; col < _blockData.GetLength(1); col++) { switch (_blockData[row, col]) { case BlockTypes.Solid: _speccy.Pen = Colors.White; _speccy.Print(startRow, col, "¬K"); break; case BlockTypes.Broken: _speccy.Pen = Colors.White; _speccy.Print(startRow, col, "¬V"); break; case BlockTypes.Missing: _speccy.Print(startRow, col, " "); break; case BlockTypes.Reactor: _speccy.Pen = Colors.Yellow; _speccy.Print(startRow, col, "*"); break; } } startRow++; } ManageBombs(); }
/// <summary> /// Prints a line of text centred on the screen. /// </summary> /// <param name="se">The se.</param> /// <param name="row">The row.</param> /// <param name="text">The text.</param> public static void PrintCentre(this SpeccyEngine se, int row, string text) { var col = (SpeccyEngine.ScreenCols - text.Length) / 2; se.Print(row, col, text); }