示例#1
0
    private void CreateVictim()
    {
        string facing = (OurUtils.RandomBool()) ? "up" : "down";

        Victim newVictim = new Victim(this, facing);

        _victimLayer.AddChild(newVictim);
        newVictim.SetScaleXY(GROUND_LAYER_SCALE, GROUND_LAYER_SCALE);

        float positionModifier = game.height * ((facing == "up") ? 1 : -1);
        float positionX        = 0;
        float positionY        = Utils.Random(newVictim.height / 2, game.height - newVictim.height / 2) + positionModifier;

        if (OurUtils.RandomBool())
        {
            //Left boardwalk
            positionX = Utils.Random(newVictim.width * 2, newVictim.width * 4 - newVictim.width / 2);
        }
        else
        {
            //Right boardwalk
            positionX = Utils.Random(game.width - newVictim.width * 4 + newVictim.width / 2, game.width - newVictim.width * 2);
        }
        SetPositionVictim(newVictim, positionX, positionY);
        //newVictim.SetXY(positionX, positionY);
        //newVictim.SetXY(Utils.Random(newVictim.width * 2, game.width - newVictim.width * 2), Utils.Random(newVictim.height / 2, game.height - newVictim.height / 2) + positionModifier);
        victimList.Add(newVictim);
    }
示例#2
0
    public Wall(Level pLevel) : base("assets/placeholders/white.png")
    {
        _scrollSpeed = Difficulty.GetScrollSpeed();
        _tileSize    = Difficulty.GetTileSize();
        _level       = pLevel;
        _length      = Utils.Random(3, 6);

        //false (x = 0), true (x = game.width)
        //_positionX = OurUtils.RandomBool() ? game.width : 0;
        bool test = OurUtils.RandomBool();

        if (test)
        {
            SetOrigin(width, 0);
            _positionX = game.width;
        }
        else
        {
            SetOrigin(0, 0);
            _positionX = 0;
        }
        _positionY = Utils.Random(0, game.height) - game.height;

        x = _positionX;
        y = _positionY;
        //Console.WriteLine(x + " " + y);
        //Console.WriteLine(_positionX + " " + _positionY);
        CreateWall(_length, _positionX, _positionY);
    }
示例#3
0
 private void AdvanceAnimation()
 {
     if (Time.time > ANIMATION_DELAY + _lastUpdatedAnimationTime)
     {
         currentFrame = OurUtils.ValueLooper(currentFrame, 0, 3);
         _lastUpdatedAnimationTime = Time.time;
     }
 }
示例#4
0
 private void AdvanceAnimation()
 {
     if (Time.time > ANIMATION_DELAY + _lastUpdatedAnimationTime)
     {
         //currentFrame = OurUtils.ValueBouncer(currentFrame, 0, 2);
         currentFrame = OurUtils.ValueCheckerAndAlternator(currentFrame, 0, 1, true);
         _lastUpdatedAnimationTime = Time.time;
     }
 }
示例#5
0
 private float Boardwalk(float pX, Victim pVictim)
 {
     if (OurUtils.RandomBool())
     {
         //Left boardwalk
         pX = Utils.Random(pVictim.width * 2, pVictim.width * 4 - pVictim.width / 2);
     }
     else
     {
         //Right boardwalk
         pX = Utils.Random(game.width - pVictim.width * 4 + pVictim.width / 2, game.width - pVictim.width * 2);
     }
     return(pX);
 }
示例#6
0
 public float Boardwalk(float pX)
 {
     if (OurUtils.RandomBool())
     {
         //Left boardwalk
         pX = Utils.Random(width * 2, width * 4 - width / 2);
     }
     else
     {
         //Right boardwalk
         pX = Utils.Random(game.width - width * 4 + width / 2, game.width - width * 2);
     }
     return(pX);
 }
示例#7
0
    private void AdvanceBirdAnimation()
    {
        if (currentFrame == 0 && _birdFlap % 3 == 0)
        {
            _actualAnimationDelay = GLIDE_TIME;
        }
        if (Time.time > _actualAnimationDelay + _lastUpdatedAnimationTime)
        {
            //currentFrame = OurUtils.ValueBouncer(currentFrame, 0, 2);
            currentFrame = OurUtils.ValueLooper(currentFrame, 0, 3);
            _lastUpdatedAnimationTime = Time.time;
            _actualAnimationDelay     = ANIMATION_DELAY;

            _birdFlap++;
        }
    }
示例#8
0
    private void CreateBike()
    {
        string facing = (OurUtils.RandomBool()) ? "up" : "down";

        VictimBike newBike = new VictimBike(this, facing);

        _victimLayer.AddChild(newBike);
        newBike.SetScaleXY(BIKE_SCALE, BIKE_SCALE);

        float positionModifier = MyGame.OldY() * ((facing == "up") ? 1 : -1);
        float positionX        = 0;
        float positionY        = Utils.Random(newBike.height / 2, MyGame.OldY() - newBike.height / 2) + positionModifier;

        positionX = newBike.CorrectLane(positionX, facing);

        newBike.SetPositionBike(newBike, positionX, positionY);

        bikeList.Add(newBike);
    }
示例#9
0
    private void CreateCar()
    {
        string facing = (OurUtils.RandomBool()) ? "up" : "down";

        VictimCar newCar = new VictimCar(this, facing);

        _victimLayer.AddChild(newCar);
        newCar.SetScaleXY(CAR_SCALE, CAR_SCALE);

        float positionModifier = MyGame.OldY() * ((facing == "up") ? 1 : -1);
        float positionX        = 0;
        float positionY        = Utils.Random(newCar.height / 2, MyGame.OldY() - newCar.height / 2) + positionModifier;

        positionX = newCar.CorrectLane(positionX, facing);

        newCar.SetPositionCar(newCar, positionX, positionY);

        carsList.Add(newCar);
    }
示例#10
0
    private void CreateVictim()
    {
        string facing = (OurUtils.RandomBool()) ? "up" : "down";

        Victim newVictim = new Victim(this, facing);

        _victimLayer.AddChild(newVictim);
        newVictim.SetScaleXY(GROUND_LAYER_SCALE, GROUND_LAYER_SCALE);

        float positionModifier = MyGame.OldY() * ((facing == "up") ? 1 : -1);
        float positionX        = 0;
        float positionY        = Utils.Random(newVictim.height / 2, MyGame.OldY() - newVictim.height / 2) + positionModifier;

        positionX = newVictim.Boardwalk(positionX);

        newVictim.SetPositionVictim(newVictim, positionX, positionY);

        victimList.Add(newVictim);
    }
示例#11
0
 private void BirdAnimation()
 {
     //Not used currently. Hasn't been updated to new standards. Refer to AdvanceAnimation()
     currentFrame = OurUtils.ValueCheckerAndAlternator(currentFrame, 0, 1, true);
     Timer fly = new Timer(250, BirdAnimation);
 }