public void CheckCollisionSphere(Objet2D theOther)
 {
     if (sphereCollision.Intersects(theOther.SphereCollision))
     {
         alive = false;
     }
 }
Beispiel #2
0
 public void CheckCollisionSphere(Objet2D theOther)
 {
     if (sphereCollision.Intersects(theOther.SphereCollision))
     {
         alive = false;
     }
 }
 public void CheckCollisionSphere(Objet2D theOther)
 {
     if (sphereCollision.Intersects(theOther.SphereCollision))
     {
         destroyed = true;
         if (theOther.GetType() == this.GetType())
         {
         }
     }
 }
        public void CheckCollisionSphere(Objet2D theOther)
        {
            if (sphereCollision.Intersects(theOther.SphereCollision))
            {
                destroyed = true;
                if (theOther.GetType() == this.GetType())
                {

                }
            }
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spacefield  = Content.Load <Texture2D>("Background\\stars");
            //sun = new Objet2D(Content.Load<Texture2D>("Background\\sun"), new Vector2(SCREENWIDTH / 2, SCREENHEIGHT / 2));
            Ship.Create(Content.Load <Texture2D>("Sprites\\PlayerShip"), new Vector2(SCREENWIDTH / 4, SCREENHEIGHT / 2));
            playerShip = Ship.GetInstance();
            asteroid   = new Asteroid(Content.Load <Texture2D>("Sprites\\bigAsteroid"), new Vector2(500, 100), AsteroidSize.BIG);

            Random r          = new Random();
            double startAngle = r.NextDouble() * 2 * Math.PI;

            asteroidMovement.X = (float)Math.Cos(startAngle) * asteroidSpeed;
            asteroidMovement.Y = (float)Math.Sin(startAngle) * asteroidSpeed;
            // TODO: use this.Content to load your game content here
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spacefield = Content.Load<Texture2D>("Background\\stars");
            //sun = new Objet2D(Content.Load<Texture2D>("Background\\sun"), new Vector2(SCREENWIDTH / 2, SCREENHEIGHT / 2));
            Ship.Create(Content.Load<Texture2D>("Sprites\\PlayerShip"), new Vector2(SCREENWIDTH / 4, SCREENHEIGHT / 2));
            playerShip = Ship.GetInstance();
            asteroid = new Asteroid(Content.Load<Texture2D>("Sprites\\bigAsteroid"), new Vector2(500, 100), AsteroidSize.BIG);

            Random r = new Random();
            double startAngle = r.NextDouble() * 2 * Math.PI;
            asteroidMovement.X = (float)Math.Cos(startAngle) * asteroidSpeed;
            asteroidMovement.Y = (float)Math.Sin(startAngle) * asteroidSpeed;
            // TODO: use this.Content to load your game content here
        }