예제 #1
0
 private void Add_Ghost(int dificulty)
 {
     ghosty            = (Ghost)ghost_for_cloning.Clone();
     ghosty.position.X = ScreenWidth + 75;
     ghosty.position.Y = random.Next(0, Game1.ScreenHeight);
     ghosty.speed     += 0.1f * dificulty;
     sprites.Add(ghosty);
     Components.Add(ghosty);
 }
예제 #2
0
        /// <summary>
        /// Used to update ghost position
        /// </summary>
        private void UpdateGhost()
        {
            Ghost = Controller.Clone();

            Tetromino test = Ghost;

            while (!Map.CheckPlaceCollision(test))
            {
                Ghost = test;
                test  = Ghost.Clone();
                test.Transform(0, Direction.Forward);
            }
        }
예제 #3
0
 private void UpdateEnemiesSpawn(GameTime gameTime)
 {
     _enemiesSpawnManager.Update(gameTime);
     while (_enemiesSpawnManager.Queue.Count > 0)
     {
         var       model = _enemiesSpawnManager.ShiftModelFromQueue();
         EnemyBase enemy = _ghost.Clone <Ghost>();
         if (model.Type == EnemyType.Bird)
         {
             enemy = _bird.Clone <Bird>();
         }
         var halfTile = MapManager.Instance.TileSize.X / 2;
         var x        = model.Side == 0 ? halfTile : MapManager.Instance.MapWidth - halfTile;
         var y        = MapManager.Instance.MapHeight - MapManager.Instance.TileSize.Y;
         if (model.Type == EnemyType.Bird)
         {
             y += 32;
         }
         enemy.SetPositionFromGround(new Vector2(x, y));
         _enemies.Add(enemy);
     }
 }