Beispiel #1
0
        /// <summary>
        /// move the whacker from wall the wall method
        /// </summary>
        /// <param name="goingTo"></param>
        /// <param name="startWall"></param>
        /// <param name="nextWall"></param>
        public void Move(Whacker.Direction goingTo, Whacker.Wall startWall, Whacker.Wall nextWall)
        {
            bool switchWall;

            switchWall = whacker.Move(goingTo, this.DisplayRectangle, startWall);

            if (switchWall)
            {
                whacker = new Whacker(this.DisplayRectangle, nextWall, goingTo);

                //WHAT WALL U ON ???
                if (goingTo == Whacker.Direction.Left)
                {
                    if (currentWall < 3)
                    {
                        currentWall++;
                    }
                    else
                    {
                        currentWall = 0;
                    }
                }
                else
                {
                    if (currentWall > 0)
                    {
                        currentWall--;
                    }
                    else
                    {
                        currentWall = 3;
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Load the game state
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GameForm_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;

            whacker       = new Whacker(this.DisplayRectangle, Whacker.Wall.Bottom, Whacker.Direction.Left);
            obstacles     = new Obstacle(this.DisplayRectangle);
            ball          = new Ball(this.DisplayRectangle);
            ball.HitCount = 0;
            currentWall   = 0;
        }