コード例 #1
0
        public void HandleCollision(CollisionDetector.Collision collision, Level1 level)
        {
            PlayerContext player = null;

            if (collision.entity1 is PlayerContext)
            {
                player = (PlayerContext)collision.entity1;
            }
            else if (collision.entity2 is PlayerContext)
            {
                player = (PlayerContext)collision.entity2;
            }


            CollisionDetector.CollisionSide side = collision.GetSide();

            if (collision.entity2 is GreenKoopaSprite || collision.entity2 is RedKoopaSprite || collision.entity2 is RedGoombaSprite)
            {
                if (side == CollisionDetector.CollisionSide.Bottom)
                {
                    side = CollisionDetector.CollisionSide.Top;
                    level.Remove(collision.entity2);
                    //make this damage them instead of remove
                }
            }
            else if (side == CollisionDetector.CollisionSide.Top)
            {
                level.Remove(collision.entity1);
            }
        }
コード例 #2
0
    //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //                                                                                                                        GameOver()
    //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    public void GameOver()
    {
        if (level1IsActive == true)
        {
            _level1.Destroy();
            _level1.Remove();
        }

        if (level2IsActive == true)
        {
            _level2.Destroy();
            _level2.Remove();
        }

        if (Globals.levelBossIsActive == true)
        {
            _levelBoss.Destroy();
            _levelBoss.Remove();
        }

        stopMusic();

        _gameover = new GameOver();
        AddChild(_gameover);
    }
コード例 #3
0
 public void HandleCollision(CollisionDetector.Collision collision, Level1 level)
 {
     if (collision.entity1 is PlayerContext)
     {
         level.Remove(collision.entity2);
     }
     else if (collision.entity2 is PlayerContext)
     {
         level.Remove(collision.entity1);
     }
 }