private void updateBTN_Click(object sender, EventArgs e) { //TODO SnakeGame.changeBackground(previewBox.BackgroundImage); GameInput.ChangeState(Keys.U, true); MessageBox.Show("تم تغيير الخريطة بنجاح"); }
private void updateBTN_Click(object sender, EventArgs e) { //TODO SnakeGame.changeBackground(previewBox.BackgroundImage); GameInput.ChangeState(Keys.U, true); MessageBox.Show("Background has been updated, close this window to apply changes"); }
// args: size? static void Main(string[] args) { var gameHeight = 16; var gameWidth = 32; CursorVisible = false; var exit = false; while (!exit) { Clear(); WriteLine("SNAKE GAME!"); WriteLine("Press any button to start..."); ReadKey(); Clear(); var gameInstance = new SnakeGame(gameHeight, gameWidth); // Construct game var score = gameInstance.Run(); // Run game exit = GameOver(score); } Environment.Exit(0); }
static void Main() { AutofacConfig.Config(); var connection = AutofacConfig.Resolve <IConnection>(); using (var game = new SnakeGame(connection)) game.Run(); }
public void updatePosition(SnakeGame parent) { Vector2 prevPos = positions[0]; Vector2 newPos; switch (currDir) { case dir.UP: positions[0] = new Vector2(positions[0].X, positions[0].Y - parent.getIncr()); if (positions[0].Y < parent.getIncr()) { int fixedPos = parent.getWindowHeight() - parent.getIncr(); fixedPos -= fixedPos % parent.getIncr(); positions[0] = new Vector2(positions[0].X, fixedPos); } break; case dir.DOWN: positions[0] = new Vector2(positions[0].X, positions[0].Y + parent.getIncr()); if (positions[0].Y > parent.getWindowHeight() - parent.getIncr()) { int fixedPos = parent.getIncr(); positions[0] = new Vector2(positions[0].X, fixedPos); } break; case dir.LEFT: positions[0] = new Vector2(positions[0].X - parent.getIncr(), positions[0].Y); if (positions[0].X < parent.getIncr()) { int fixedPos = parent.getWindowWidth() - parent.getIncr(); fixedPos -= fixedPos % parent.getIncr(); positions[0] = new Vector2(fixedPos, positions[0].Y); } break; case dir.RIGHT: positions[0] = new Vector2(positions[0].X + parent.getIncr(), positions[0].Y); if (positions[0].X > parent.getWindowWidth() - parent.getIncr()) { int fixedPos = parent.getIncr(); positions[0] = new Vector2(fixedPos, positions[0].Y); } break; } for (int i = 1; i < positions.Count; i++) { newPos = prevPos; prevPos = positions[i]; positions[i] = newPos; } }
static void Main(string[] args) { Console.WriteLine("Nyomj egy ENTERT a játékhoz."); Console.ReadLine(); while (true) { var game = new SnakeGame(); game.Run(8); System.Threading.Thread.Sleep(5000); Console.Clear(); Console.WriteLine($"Elért pontszámod: {game.Points}"); Console.WriteLine("Enter az újrakezdéshez"); Console.ReadLine(); } }
public Form1() { _SnakeGame = new SnakeGame(); InitializeComponent(); }
static void Main() { using (var game = new SnakeGame()) game.Run(); }
static void Main(string[] args) { var disp = new ConsoleDisplay(100, 50); var game= new SnakeGame(); var engine = new GameEngine(game, disp); engine.Initialize(); engine.Start(); }