public void draw()
        {
            for (int i = 0; i < body.Count; i++)
            {
                mainBoard.draw(body[i], Properties.Resources.nyan_cat_rainbow_png_6);
            }

            mainBoard.draw(body[0], Properties.Resources.Nyan_Cat); //Index 0 is always the head
        }
示例#2
0
        public void draw()
        {
            for (int i = 0; i < body.Count; i++)
            {
                mainBoard.draw(body[i], bodyImage);
            }

            mainBoard.draw(body[0], headImage); //Index 0 is always the head
        }
示例#3
0
 public void draw()
 {
     for (int i = 0; i < applelist.Count; i++)
     {
         mainBoard.draw(applelist[i], rewardImage);
     }
 }
 public void draw()
 {
     for (int i = 0; i < appleList.Count; i++)
     {
         mainBoard.draw(appleList[i], Properties.Resources.Png);
     }
 }
示例#5
0
        private void refresh(Object myObject, EventArgs myEventArgs)
        {
            if (!isPaused)
            {
                mySnake.move(mode); //Move the snake based on mode
            }


            mainBoard.draw();
            apples.draw();  //<----- draw apples
            mySnake.draw();

            //increment the duration by amount of time that has passed
            //this method is called every speed millisecond
            duration     += speed;
            timerLBL.Text = Convert.ToString(duration / 1000); //Show time passed

            //Check if snke is biting itself. If so, call GameOver.
            if (mySnake.checkEatItself() == true)
            {
                GameOver();
            }
            else if (apples.checkIFSnakeEatApple(mySnake) == true)
            {
                eatFood.Play();

                score += apples.eatAppleAtPostion(mySnake.getHeadPosition());

                scoreLBL.Text = Convert.ToString(score);


                if (apples.noMoreApples() == true)
                {
                    isStarted = false;
                    clock.Stop();
                    level++;
                    levelLBL.Text = Convert.ToString(level);
                    gotoNextLevel(level);
                    MessageBox.Show("Press enter to go to Level " + level, "Congrats");
                    clock.Interval = speed -= 100;
                }
                else
                {
                    //Length the snake and continue with the Game
                    mySnake.extendBody();
                }
            }
        }