예제 #1
0
        public Game()
        {
            //code for setting up gui elements
            InitializeComponent();

            //initilize settings

            /**
             * settings class contains size of sqaures on board
             * the speed of the snake
             * whether the game is over or not
             * the current score
             */
            new Settings();

            //initilizes size of canvas to fit the squares perfectly
            canvas_Size      = new Size(Settings.Width * 25, Settings.Height * 25);
            SnakeCanvas.Size = canvas_Size;

            //Set game speed and start timer
            GamerTimer.Interval = 1000 / Settings.Speed;

            //for every timer interval it calls the update screen method
            GamerTimer.Tick += UpdateScreen;
            GamerTimer.Start();

            printScore();

            //start new Game
            startGame();
        }
예제 #2
0
        private void FormGame_Load(object sender, EventArgs e)
        {
            InterfaceGraphique graphics = new InterfaceGraphique();

            graphics.LoadGraphicsInForm();
            GamerTimer.Start();
        }