Example #1
0
 public void Update(paddle p, FireBallBar fbb)
 {
     position.Y += velocity;
     if (position.Intersects(p.bounds))
     {
         fbb.numOfBalls++;
     }
 }
Example #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            ms = new MouseState();

            myGrid = new Grid(new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), 20, 40);
            myBall = new Ball(this, "Ball");
            myPaddle = new paddle(1);
            myCursor = new Cursor(this, ms, "Cursor");
            myFireBar = new FireBallBar(this, "FireBallBar", new Rectangle(0, 550, 100, 50), ms);

            base.Initialize();
        }
Example #3
0
        public FireBall(Game1 game, String image, paddle Paddle, int MouseX, int MouseY)
        {
            //Get the image
            this.image = game.Content.Load<Texture2D>(image);

            this.MouseX = MouseX - this.image.Bounds.Width / 2;
            this.MouseY = MouseY - this.image.Bounds.Height / 2;
            curX = Paddle.bounds.X + Paddle.bounds.Width / 2 - this.image.Bounds.Width / 2;
            curY = Paddle.bounds.Y - this.image.Bounds.Height / 2;

            //calc current triangle width
            triangleWidth = MouseX - curX;
            //calc current triangle height
            triangleHeight = curY - MouseY;
            //calc current hypotenmoose
            triangleHyp = (int)Math.Sqrt(triangleWidth * triangleWidth + triangleHeight * triangleHeight);

            Update();
        }
Example #4
0
 public void Fire(Game1 game, String image, paddle p)
 {
     //if (numOfBalls >= 0)
     //{
         fireballs.Add(new FireBall(game, image, p, ms.X, ms.Y));
         //numOfBalls--;
     //}
 }
        public void Update(paddle p, FireBallBar fbb)
        {
            for (int i = 0; i < fireTokens.Count; i++)
            {
                FireToken temp = fireTokens[i];

                temp.Update(p, fbb);
            }
        }