Example #1
0
    public Level() : base()
    {
        difficulty = new Difficulty(); //Don't ask please.

        //initialise variables
        _scrollSpeed = Difficulty.GetScrollSpeed();
        _tileSize    = Difficulty.GetTileSize();

        //Timer initialization
        _lastUpdatedVictimTime = 0;
        _lastUpdatedEnemyTime  = 0;

        //Depth
        _floorLayer  = new LevelLayer();
        _victimLayer = new LevelLayer();
        _poopLayer   = new LevelLayer();
        _flightLayer = new LevelLayer();
        _hudLayer    = new LevelLayer();
        AddChild(_floorLayer);
        AddChild(_victimLayer);
        AddChild(_poopLayer);
        AddChild(_flightLayer);
        AddChild(_hudLayer);

        CreatePlayer();
        CreateRoad();
        //CreateEnemy();
        CreateHUD();

        Constipation newdebuff = new Constipation(this);

        _poopLayer.AddChild(newdebuff);
        newdebuff.SetXY(Utils.Random(0, game.width), Utils.Random(0, game.height) - game.height);

        BeakOfSteel newbuff = new BeakOfSteel(this);

        _poopLayer.AddChild(newbuff);
        newbuff.SetXY(Utils.Random(0, game.width), Utils.Random(0, game.height) - game.height);
    }
Example #2
0
    private void CreatePower <T>()
    {
        BasePower newPower;

        if (typeof(T) == typeof(Food))
        {
            newPower = new Food(this);
        }
        else if (typeof(T) == typeof(Laxative))
        {
            newPower = new Laxative(this);
        }
        else if (typeof(T) == typeof(SpeedUp))
        {
            newPower = new SpeedUp(this);
        }
        else if (typeof(T) == typeof(DoublePoints))
        {
            newPower = new DoublePoints(this);
        }
        else if (typeof(T) == typeof(BeakOfSteel))
        {
            newPower = new BeakOfSteel(this);
        }
        else if (typeof(T) == typeof(Constipation))
        {
            newPower = new Constipation(this);
        }
        else if (typeof(T) == typeof(RottenFood))
        {
            newPower = new RottenFood(this);
        }
        else
        {
            newPower = new Food(this);
        }
        _powerUpLayer.AddChild(newPower);
        newPower.SetXY(Utils.Random(100, MyGame.OldX() - 100), Utils.Random(newPower.height / 2, MyGame.OldY() - newPower.height / 2) - game.height * 2);
    }