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); }
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); }
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); }
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); }
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); }
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); }
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); }