Esempio n. 1
0
 /************************************************************************/
 /* Detects collisions between for a GameObject on other objects         */
 /************************************************************************/
 public bool checkCollision(GameObject go1, GameObject[] go2)
 {
     int i;
     for (i = 0; i < go2.Length; i++)
     {
         if (go1.BoundingBox.Intersects(go2[i].BoundingBox))
         {
             return true;
         }
     }
     return false;
 }
Esempio n. 2
0
        private void initializeGameworld(ContentHolder contentHolder)
        {
            playerObject = new Player(  contentHolder.texturePlayer,
                                        contentHolder.texturePlayerTurret,
                                        contentHolder.texturePlayerBullet,
                                        contentHolder.texturePlayerSpecal01,
                                      0, 0, Vector2.Zero, 5000);

            gravityWell = new GameObject(contentHolder.textureGravityWell,
                                         playerObject.Position.X,
                                         playerObject.Position.Y,
                                         Vector2.Zero,
                                         0);

            levelBounds = createBounds();
            background01 = new Background(contentHolder.bg_variant0, playerObject.Velocity, levelBounds, 0, 0, 0.4f);
            background02 = new Background(contentHolder.bg_variant1, playerObject.Velocity, levelBounds, 0, 0, 0.2f);

            // The following should (and will, eventually) be loaded by reading a file generated by an editor,
            //  so this is temp, testing etc
            particleSystem.newEmitter(contentHolder.particle_smoke, getPlayer().Position, 0, 200, 12, false, getPlayer().Velocity);

            rocks.Add(new Collidable(contentHolder.textureRock01,  150,  300, Vector2.Zero, true, 600));
            rocks.Add(new Collidable(contentHolder.textureRock02, -250, -330, Vector2.Zero, true, 400));
            rocks.Add(new Collidable(contentHolder.textureRock01, 500, 300, Vector2.Zero, true, 100));
            rocks.Add(new Collidable(contentHolder.textureRock02, -100, 250, Vector2.Zero, true, 250));

            rocks.Add(new Collidable(contentHolder.textureRock01, 0, -250, new Vector2(0, -2), true, 200));

            //for (int i = 0; i < 20; i++)
            //{

            //    enemies.Add(new Enemy(contentHolder.textureEnemy01, contentHolder.texturePlayerTurret, contentHolder.texturePlayerBullet, i * 20 + 200, i * 20 + 200, Vector2.Zero, 1000));
            //}
        }