예제 #1
0
 public static void softPause()
 {
     if (!softpaused)
     {
         softpaused = true;
         Jukebox.playBeginSound();
     }
 }
예제 #2
0
        // Angular Collision Logic. Passed An Enumerator That Denotes What Critical Area Was Hit (Either A Wall, Paddle, Or Score Zone) //
        private void changeAngle(int condition)
        {
            if (condition == (int)Intersection.Left)
            {
                Jukebox.playScore();
                RScore.incrementRScore();
                ballmovespeed = 200;
                this.setVector(new Vector2(320, 240));

                if (!TimeCalculator.softpaused)
                {
                    TimeCalculator.softPause();
                }
            }
            else if (condition == (int)Intersection.Right)
            {
                Jukebox.playScore();
                LScore.incrementLScore();
                ballmovespeed = 200;
                this.setVector(new Vector2(320, 240));

                if (!TimeCalculator.softpaused)
                {
                    TimeCalculator.softPause();
                }
            }
            else if (condition == (int)Intersection.Top)
            {
                Jukebox.playWallHit();
                if (lastX - position.X < 0)
                {
                    if (lastY - position.Y < 0)
                    {
                        diagonal = (int)Diagonal.UpLeft;
                    }
                    else
                    {
                        diagonal = (int)Diagonal.DownRight;
                    }
                }
                else
                {
                    if (lastY - position.Y < 0)
                    {
                        diagonal = (int)Diagonal.UpRight;
                    }
                    else
                    {
                        diagonal = (int)Diagonal.DownLeft;
                    }
                }
            }
            else if (condition == (int)Intersection.Bot)
            {
                Jukebox.playWallHit();
                if (lastX - position.X < 0)
                {
                    if (lastY - position.Y < 0)
                    {
                        diagonal = (int)Diagonal.UpRight;
                    }
                    else
                    {
                        diagonal = (int)Diagonal.DownLeft;
                    }
                }
                else
                {
                    if (lastY - position.Y < 0)
                    {
                        diagonal = (int)Diagonal.UpLeft;
                    }
                    else
                    {
                        diagonal = (int)Diagonal.UpLeft;
                    }
                }
            }
            else if (condition == (int)Intersection.LeftPaddle)
            {
                Jukebox.playPaddleHit();
                if (lastX - position.X < 0)
                {
                    if (lastY - position.Y < 0)
                    {
                        diagonal = (int)Diagonal.DownLeft;
                    }
                    else
                    {
                        diagonal = (int)Diagonal.UpLeft;
                    }
                }
                else
                {
                    if (lastY - position.Y < 0)
                    {
                        diagonal = (int)Diagonal.DownRight;
                    }
                    else
                    {
                        diagonal = (int)Diagonal.UpRight;
                    }
                }

                increaseSpeed();
            }
            else if (condition == (int)Intersection.RightPaddle)
            {
                Jukebox.playPaddleHit();
                if (lastX - position.X < 0)
                {
                    if (lastY - position.Y < 0)
                    {
                        diagonal = (int)Diagonal.DownLeft;
                    }
                    else
                    {
                        diagonal = (int)Diagonal.UpLeft;
                    }
                }
                else
                {
                    if (lastY - position.Y < 0)
                    {
                        diagonal = (int)Diagonal.UpRight;
                    }
                    else
                    {
                        diagonal = (int)Diagonal.DownRight;
                    }
                }

                increaseSpeed();
            }
            else
            {
            }
        }