public Flag(Vector2 location) { sprite = ItemSpriteFactory.Instance.CreateFlagSprite(); Location = location; Destination = sprite.MakeDestinationRectangle(Location); Velocity = new Vector2(0, 0); }
public LPipeBottom(Vector2 location, Vector2 teleLocation) { sprite = PipeSpriteFactory.Instance.CreateLPipeBottomSprite(); Location = location; Destination = sprite.MakeDestinationRectangle(Location); this.teleLocation = teleLocation; IsTelable = true; }
public Flower(Vector2 location) { sprite = ItemSpriteFactory.Instance.CreateFlowerSprite(); Location = location; initialLocation = location; Destination = sprite.MakeDestinationRectangle(Location); Velocity = new Vector2(GameUtilities.StationaryVelocity, -GameUtilities.FlowerGravity); }
public BigPipe(Vector2 location, Vector2 teleLocation) { sprite = PipeSpriteFactory.Instance.CreateBigPipeSprite(); Location = location; Destination = sprite.MakeDestinationRectangle(Location); this.teleLocation = teleLocation; canWarp = true; }
public void Update() { if (IsPreparing) { Location = new Vector2(Location.X, Location.Y + Velocity.Y); Destination = sprite.MakeDestinationRectangle(Location); if (Location.Y <= initialLocation.Y - Destination.Height + 2 * GameUtilities.SinglePixel) { Velocity = new Vector2(GameUtilities.StationaryVelocity, GameUtilities.StationaryVelocity); IsPreparing = false; } return; } Destination = sprite.MakeDestinationRectangle(Location); sprite.Update(); }
public void Update() { if (IsPreparing) { Location = new Vector2(Location.X, Location.Y + Velocity.Y); Destination = sprite.MakeDestinationRectangle(Location); if (Location.Y <= initialLocation.Y - Destination.Height + 2 * 1) { Velocity = new Vector2(0, 0); IsPreparing = false; } return; } Destination = sprite.MakeDestinationRectangle(Location); sprite.Update(); }
public FireFlower(Vector2 location) { sprite = ItemSpriteFactory.Instance.CreateFlowerSprite(); Location = location; initialLocation = location; Destination = sprite.MakeDestinationRectangle(Location); Velocity = new Vector2(0, -0.5f); }
public Star(Vector2 location) { sprite = ItemSpriteFactory.Instance.CreateStarSprite(); Location = location; initialLocation = location; Destination = sprite.MakeDestinationRectangle(Location); Velocity = new Vector2(0, -0.5f); Acceleration = new Vector2(0, 0); }
public PiranhaPlants(Vector2 location, MarioObject Mario) { sprite = ItemSpriteFactory.Instance.CreatePiranhaPlantsSprite(); Location = location; initialLocation = location; Destination = sprite.MakeDestinationRectangle(Location); Velocity = new Vector2(0, -0.2f); mario = Mario; }
public GreenMushroom(Vector2 location) { sprite = ItemSpriteFactory.Instance.CreateGreenMushroomSprite(); this.Location = location; initialLocation = location; Destination = sprite.MakeDestinationRectangle(Location); Velocity = new Vector2(0, -0.5f); Acceleration = new Vector2(0, 0); }
public void Draw(SpriteBatch spriteBatch) { if (Game1.State.Type == GameStates.Victory) { backgroundSprite.Draw(spriteBatch, new Vector2(Camera.CameraX, 0)); int halfOfGameOverTextWidth = winningTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2; int winningTextY = screenHeight / 2 - 100; winningTextSprite.Draw(spriteBatch, new Vector2(Camera.CameraX + Camera.CenterOfScreen - halfOfGameOverTextWidth, winningTextY)); int marioTitleTextX = Camera.CameraX + (Camera.CenterOfScreen * 2 / 5 - (marioTitleTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); marioTitleTextSprite.Draw(spriteBatch, new Vector2(marioTitleTextX, screenHeight / 2 - 40)); int scoreTextX = Camera.CameraX + (Camera.CenterOfScreen * 2 / 5 - (scoreTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); scoreTextSprite.Draw(spriteBatch, new Vector2(scoreTextX, screenHeight / 2)); int coinTextX = Camera.CameraX + (Camera.CenterOfScreen * 4 / 5 - (coinTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); coinTextSprite.Draw(spriteBatch, new Vector2(coinTextX, screenHeight / 2 - 45)); int coinX = coinTextX - coinSprite.MakeDestinationRectangle(Vector2.Zero).Width + 2; int coinY = screenHeight / 2 - 40 - coinSprite.MakeDestinationRectangle(Vector2.Zero).Height / 3; coinSprite.Draw(spriteBatch, new Vector2(coinX, coinY)); int marioX = Camera.CameraX + (Camera.CenterOfScreen * 6 / 5 - (marioSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3) - 20); marioSprite.Draw(spriteBatch, new Vector2(marioX, screenHeight / 2 - 60)); int multiTextX = Camera.CameraX + (Camera.CenterOfScreen * 6 / 5 - (multiTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); multiTextSprite.Draw(spriteBatch, new Vector2(multiTextX, screenHeight / 2 - 40)); int lifeTextX = Camera.CameraX + (Camera.CenterOfScreen * 6 / 5 - (lifeTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3) + 10); lifeTextSprite.Draw(spriteBatch, new Vector2(lifeTextX, screenHeight / 2 - 40)); int timeTitleTextX = Camera.CameraX + (Camera.CenterOfScreen * 8 / 5 - (timeTitleTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); timeTitleTextSprite.Draw(spriteBatch, new Vector2(timeTitleTextX, screenHeight / 2 - 40)); int timeTextX = Camera.CameraX + (Camera.CenterOfScreen * 8 / 5 - (timeTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); timeTextSprite.Draw(spriteBatch, new Vector2(timeTextX, screenHeight / 2)); int askForContX = Camera.CameraX + Camera.CenterOfScreen - (AskForContSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2); AskForContSprite.Draw(spriteBatch, new Vector2(askForContX, winningTextY + 140)); } }
public CoinOutOfBlockAnimation(Vector2 location) { this.coinSprite = ItemSpriteFactory.Instance.CreateCoinSprite(); this.State = AnimationState.ToBegin; Rectangle spriteDestination = coinSprite.MakeDestinationRectangle(location); int halfOfDestinationHeight = spriteDestination.Height / 2; this.endLocationY = location.Y - halfOfDestinationHeight; this.location = new Vector2(location.X, endLocationY); }
public void Draw(SpriteBatch spriteBatch) { if (IsCompetitiveMode()) { return; } int marioTitleTextX = Camera2D.CameraX + (Camera2D.CenterOfScreen * GameUtilities.Two / HUDUtilities.Fifths - (marioTitleTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / GameUtilities.Two)); marioTitleTextSprite.Draw(spriteBatch, new Vector2(marioTitleTextX, distanceOfFirstRowText)); int scoreTextX = Camera2D.CameraX + (Camera2D.CenterOfScreen * GameUtilities.Two / HUDUtilities.Fifths - (scoreTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / GameUtilities.Two)); scoreTextSprite.Draw(spriteBatch, new Vector2(scoreTextX, distanceOfSecondRowText)); int coinTextX = Camera2D.CameraX + (Camera2D.CenterOfScreen * GameUtilities.Four / HUDUtilities.Fifths - (coinTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / GameUtilities.Two)); coinTextSprite.Draw(spriteBatch, new Vector2(coinTextX, distanceOfSecondRowText)); int coinX = coinTextX - coinSprite.MakeDestinationRectangle(Vector2.Zero).Width + GameUtilities.Two; int coinY = distanceOfSecondRowText - coinSprite.MakeDestinationRectangle(Vector2.Zero).Height / GameUtilities.Two; coinSprite.Draw(spriteBatch, new Vector2(coinX, coinY)); int worldTitleTextX = Camera2D.CameraX + (Camera2D.CenterOfScreen * GameUtilities.Six / HUDUtilities.Fifths - (worldTitleTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / GameUtilities.Two)); worldTitleTextSprite.Draw(spriteBatch, new Vector2(worldTitleTextX, distanceOfFirstRowText)); int worldTextX = Camera2D.CameraX + (Camera2D.CenterOfScreen * GameUtilities.Six / HUDUtilities.Fifths - (worldTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / GameUtilities.Two)); worldTextSprite.Draw(spriteBatch, new Vector2(worldTextX, distanceOfSecondRowText)); int timeTitleTextX = Camera2D.CameraX + (Camera2D.CenterOfScreen * GameUtilities.Eight / HUDUtilities.Fifths - (timeTitleTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / GameUtilities.Two)); timeTitleTextSprite.Draw(spriteBatch, new Vector2(timeTitleTextX, distanceOfFirstRowText)); int timeTextX = Camera2D.CameraX + (Camera2D.CenterOfScreen * GameUtilities.Eight / HUDUtilities.Fifths - (timeTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / GameUtilities.Two)); timeTextSprite.Draw(spriteBatch, new Vector2(timeTextX, distanceOfSecondRowText)); }
public void Draw(SpriteBatch spriteBatch) { int marioTitleTextX = Camera.CameraX + (Camera.CenterOfScreen * 2 / 5 - (marioTitleTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); marioTitleTextSprite.Draw(spriteBatch, new Vector2(marioTitleTextX, -Camera.CameraY + FirstRow)); int scoreTextX = Camera.CameraX + (Camera.CenterOfScreen * 2 / 5 - (scoreTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); scoreTextSprite.Draw(spriteBatch, new Vector2(scoreTextX, -Camera.CameraY + SecondRow)); int coinTextX = Camera.CameraX + (Camera.CenterOfScreen * 4 / 5 - (coinTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); coinTextSprite.Draw(spriteBatch, new Vector2(coinTextX, -Camera.CameraY + FirstRow - 5)); int coinX = coinTextX - coinSprite.MakeDestinationRectangle(Vector2.Zero).Width + 2; int coinY = -Camera.CameraY + FirstRow - coinSprite.MakeDestinationRectangle(Vector2.Zero).Height / 3; coinSprite.Draw(spriteBatch, new Vector2(coinX, coinY)); int marioX = Camera.CameraX + (Camera.CenterOfScreen * 6 / 5 - (marioSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3) - 20); marioSprite.Draw(spriteBatch, new Vector2(marioX, -Camera.CameraY + marioRow)); int multiTextX = Camera.CameraX + (Camera.CenterOfScreen * 6 / 5 - (multiTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); multiTextSprite.Draw(spriteBatch, new Vector2(multiTextX, -Camera.CameraY + FirstRow)); int lifeTextX = Camera.CameraX + (Camera.CenterOfScreen * 6 / 5 - (lifeTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3) + 10); lifeTextSprite.Draw(spriteBatch, new Vector2(lifeTextX, -Camera.CameraY + FirstRow)); int timeTitleTextX = Camera.CameraX + (Camera.CenterOfScreen * 8 / 5 - (timeTitleTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); timeTitleTextSprite.Draw(spriteBatch, new Vector2(timeTitleTextX, -Camera.CameraY + FirstRow)); int timeTextX = Camera.CameraX + (Camera.CenterOfScreen * 8 / 5 - (timeTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 3)); timeTextSprite.Draw(spriteBatch, new Vector2(timeTextX, -Camera.CameraY + SecondRow)); }
public CoinCollectedFromBlockAnimation(Vector2 location) { this.coinSprite = ItemSpriteFactory.Instance.CreateCoinSprite(); this.State = AnimationState.NotStart; Rectangle spriteDestination = coinSprite.MakeDestinationRectangle(location); int halfOfDestinationHeight = spriteDestination.Height / 2; this.endLocationY = location.Y - halfOfDestinationHeight; this.location = new Vector2(location.X, endLocationY); Vector2 scoreLocation = new Vector2(spriteDestination.X, spriteDestination.Y - spriteDestination.Height); this.scoreAnimation = new ScoreTextAnimation(scoreLocation, "200"); }
public void Update() { if (IsPreparing) { Location = new Vector2(Location.X, Location.Y + Velocity.Y); Destination = sprite.MakeDestinationRectangle(Location); if (Location.Y <= initialLocation.Y - this.Destination.Height) { Velocity = new Vector2(2, 0); Acceleration = new Vector2(0, 0.5f); IsPreparing = false; } return; } if (Velocity.Y < 6) { Velocity = new Vector2(Velocity.X, Velocity.Y + Acceleration.Y); } Location = new Vector2(Location.X + Velocity.X, Location.Y + Velocity.Y); Destination = sprite.MakeDestinationRectangle(Location); sprite.Update(); }
public void Update() { if (IsPreparing) { Location = new Vector2(Location.X, Location.Y + Velocity.Y); Destination = sprite.MakeDestinationRectangle(Location); if (Location.Y <= initialLocation.Y - this.Destination.Height) { this.Velocity = new Vector2(3, 0); this.Acceleration = new Vector2(0, GameData.Gravity); IsPreparing = false; } return; } if (Velocity.Y < 3) { this.Velocity = new Vector2(this.Velocity.X, this.Velocity.Y + this.Acceleration.Y); } this.Location = new Vector2(this.Location.X + this.Velocity.X, this.Location.Y + this.Velocity.Y); Destination = sprite.MakeDestinationRectangle(Location); sprite.Update(); }
public void Draw(SpriteBatch spriteBatch) { if (Game1.State.Type == GameStates.Title) { int titleImgX = Camera.CameraX + Camera.CenterOfScreen - (titleImg.MakeDestinationRectangle(Vector2.Zero).Width / 2); titleImg.Draw(spriteBatch, new Vector2(titleImgX, titleImgY)); int instructionTextX = Camera.CameraX + Camera.CenterOfScreen - (instructionText.MakeDestinationRectangle(Vector2.Zero).Width / 2); instructionText.Draw(spriteBatch, new Vector2(instructionTextX, instructionY)); int highestScoreTextX = Camera.CameraX + Camera.CenterOfScreen - (highestScoreText.MakeDestinationRectangle(Vector2.Zero).Width / 2); highestScoreText.Draw(spriteBatch, new Vector2(highestScoreTextX, highestScoreY)); } }
public void Update() { if (Math.Abs(Location.X - mario.Location.X) < 50) { Location = new Vector2(Location.X, Location.Y + 2); Destination = sprite.MakeDestinationRectangle(Location); if (Location.Y >= initialLocation.Y - Destination.Height + 2 * 1) { Velocity = new Vector2(0, 0); } adjectent = true; IsPreparing = true; return; } if (Math.Abs(Location.X - mario.Location.X) > 50) { adjectent = false; Velocity = new Vector2(0, -0.2f); } if (IsPreparing && !adjectent) { Location = new Vector2(Location.X, Location.Y + Velocity.Y); Destination = sprite.MakeDestinationRectangle(Location); if (Location.Y <= initialLocation.Y - Destination.Height + 2 * 1) { Velocity = new Vector2(0, 0); IsPreparing = false; } return; } Destination = sprite.MakeDestinationRectangle(Location); sprite.Update(); }
// private bool CanUpdate { get { return hasBeenInView; } } public Spawner(Vector2 location, bool rightFacing) { Type = GameObjectType.ObjectType.Spawner; if (rightFacing) { spawnSprite = PipeSpriteFactory.Instance.CreateLPipeBottomLeftSprite(); } else { spawnSprite = PipeSpriteFactory.Instance.CreateLPipeBottomSprite(); } Location = location; RightFacing = rightFacing; Destination = spawnSprite.MakeDestinationRectangle(Location); bufferVelocity = new Vector2(GameUtilities.StationaryVelocity); bufferDistance = bufferDistanceConst; hasBeenInView = false; }
public void Draw(SpriteBatch spriteBatch) { if (GameUtilities.Game.State.Type == GameStates.CompetitivePreparing) { backgroundSprite.Draw(spriteBatch, new Vector2(Camera2D.CameraX, GameUtilities.Origin)); int worldTextX = Camera2D.CameraX + Camera2D.CenterOfScreen - (worldTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2); worldTextSprite.Draw(spriteBatch, new Vector2(worldTextX, firstRowY)); int multiTextX = Camera2D.CameraX + Camera2D.CenterOfScreen - (multiTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2); multiTextSprite.Draw(spriteBatch, new Vector2(multiTextX, secRowY)); int marioX = Camera2D.CameraX + Camera2D.CenterOfScreen - marioSprite.MakeDestinationRectangle(Vector2.Zero).Width * 3; marioSprite.Draw(spriteBatch, new Vector2(marioX, firstRowY)); int mario2X = Camera2D.CameraX + Camera2D.CenterOfScreen + mario2Sprite.MakeDestinationRectangle(Vector2.Zero).Width * 2; mario2Sprite.Draw(spriteBatch, new Vector2(mario2X, firstRowY)); } }
public void Draw(SpriteBatch spriteBatch) { if (GameUtilities.Game.State.Type == GameStates.LifeDisplay) { backgroundSprite.Draw(spriteBatch, new Vector2(Camera2D.CameraX, GameUtilities.Origin)); int worldTextX = Camera2D.CameraX + Camera2D.CenterOfScreen - (worldTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2); worldTextSprite.Draw(spriteBatch, new Vector2(worldTextX, firstRowY)); int multiTextX = Camera2D.CameraX + Camera2D.CenterOfScreen - (multiTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2); multiTextSprite.Draw(spriteBatch, new Vector2(multiTextX, secRowY)); int lifeTextX = Camera2D.CameraX + Camera2D.CenterOfScreen - (lifeTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2) + 20; lifeTextSprite.Draw(spriteBatch, new Vector2(lifeTextX, secRowY)); int marioX = Camera2D.CameraX + Camera2D.CenterOfScreen - (marioSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2) - 20; marioSprite.Draw(spriteBatch, new Vector2(marioX, firstRowY)); } }
public void Draw(SpriteBatch spriteBatch) { if (Game1.State.Type == GameStates.LifeDisplay) { backgroundSprite.Draw(spriteBatch, new Vector2(Camera.CameraX, -Camera.CameraY)); int worldTextX = Camera.CameraX + Camera.CenterOfScreen - (worldTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2); worldTextSprite.Draw(spriteBatch, new Vector2(worldTextX, -Camera.CameraY + firstRowY)); int multiTextX = Camera.CameraX + Camera.CenterOfScreen - (multiTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2); multiTextSprite.Draw(spriteBatch, new Vector2(multiTextX, -Camera.CameraY + secRowY)); int lifeTextX = Camera.CameraX + Camera.CenterOfScreen - (lifeTextSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2) + 20; lifeTextSprite.Draw(spriteBatch, new Vector2(lifeTextX, -Camera.CameraY + secRowY)); int marioX = Camera.CameraX + Camera.CenterOfScreen - (marioSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2) - 20; marioSprite.Draw(spriteBatch, new Vector2(marioX, -Camera.CameraY + marioRowY)); int askForContX = Camera.CameraX + Camera.CenterOfScreen - (AskForContSprite.MakeDestinationRectangle(Vector2.Zero).Width / 2); AskForContSprite.Draw(spriteBatch, new Vector2(askForContX, -Camera.CameraY + thirdRowY)); } }
public void Update() { Destination = sprite.MakeDestinationRectangle(Location); sprite.Update(); }
public Rectangle MakeDestinationRectangle(Vector2 location) { return(sprite.MakeDestinationRectangle(location)); }
public BigBush(Vector2 location) { sprite = BackgroundSpriteFactory.Instance.CreateBigBushSprite(); Location = location; Destination = sprite.MakeDestinationRectangle(Location); }
public void Update() { Location = new Vector2(Location.X, Location.Y + Velocity.Y); Destination = sprite.MakeDestinationRectangle(Location); sprite.Update(); }
public StairBlock(Vector2 location) { sprite = BlockSpriteFactory.Instance.CreateStairBlock(); Location = location; Destination = sprite.MakeDestinationRectangle(Location); }
public LPipeBottom(Vector2 location) { sprite = PipeSpriteFactory.Instance.CreateLPipeBottomSprite(); Location = location; Destination = sprite.MakeDestinationRectangle(Location); }
public Coin(Vector2 location) { sprite = ItemSpriteFactory.Instance.CreateCoinSprite(); Location = location; Destination = sprite.MakeDestinationRectangle(Location); }