예제 #1
0
        private static void SecondPlayerBallDraw(SpriteBatch spriteBatch)
        {
            if (ballSecond.BallFired && ballSecond.FireFlashCounter < 15)
            {
                ballSecond.Fire.Draw(spriteBatch, new Vector2(SecondPlayer.Instance.Ship.Position.X - SecondPlayer.Instance.ShipImage.Texture.Width * 0.9f, SecondPlayer.Instance.Ship.Position.Y + SecondPlayer.Instance.ShipImage.Texture.Height * 0.1f));
                ballSecond.FireFlashCounter++;
            }

            if (ballSecond.BallFired)
            {
                ballSecond.SetPositionRangeX((ballFirst.BallFiredPos.X + (ScreenManager.Instance.Dimensions.X / 2) - SecondPlayer.Instance.ShipImage.Texture.Width));

                if (ballSecond.Position.Y < ballSecond.BallFiredPos.Y)
                {
                    ballSecond.Draw(spriteBatch);
                }
                else if (secondBallTimer.Elapsed.TotalSeconds > DefaultBallTimer)
                {
                    ballSecond.BallInitialised = false;
                    ballSecond.BallFired       = false;
                    secondBallTimer.Stop();
                    secondBallTimer.Reset();
                }
            }
        }
예제 #2
0
        private static void FirstPlayerBallDraw(SpriteBatch spriteBatch)
        {
            if (ballFirst.BallFired && ballFirst.FireFlashCounter < 15)
            {
                ballFirst.Fire.Draw(spriteBatch, new Vector2(FirstPlayer.Instance.Ship.Position.X + FirstPlayer.Instance.ShipImage.Texture.Width, FirstPlayer.Instance.Ship.Position.Y + (FirstPlayer.Instance.ShipImage.Texture.Height * 0.6f) - (ballFirst.Fire.Texture.Height / 2f)));
                ballFirst.FireFlashCounter++;
            }

            if (!ballFirst.BallFired)
            {
                return;
            }
            ballFirst.SetPositionRangeX((ballFirst.BallFiredPos.X + (ScreenManager.Instance.Dimensions.X / 2) - FirstPlayer.Instance.ShipImage.Texture.Width));

            if (ballFirst.Position.Y < ballFirst.BallFiredPos.Y)
            {
                ballFirst.Draw(spriteBatch);
            }
            else if (firstBallTimer.Elapsed.TotalSeconds > DefaultBallTimer)
            {
                ballFirst.BallInitialised = false;
                ballFirst.BallFired       = false;
                firstBallTimer.Stop();
                firstBallTimer.Reset();
            }
        }