public Fireball(Vector2 position, bool isRight, bool isEnemyFireball) { expirationBuffer = GameValues.FireBallExpirationBuffer; fireballStateTransitionMachine = new FireballStateTransitionMachine(); sprite = AnimatedSpriteFactory.Instance.BuildFireballSprite(position); CollisionRectangle = sprite.SpriteDestinationRectangle; this.Position = new Vector2(position.X, position.Y); // isRight is determined by if Mario is facing right or left, which leads to which direction // this fireball should go. if (isRight) { this.Velocity = GameValues.FireBallVelocity; this.MaxVelocity = GameValues.FireBallMaxVelocity; } else { this.Velocity = -GameValues.FireBallVelocity; this.MaxVelocity = GameValues.FireBallMaxVelocity; } this.IsAlive = false; this.IsEnemyFireball = isEnemyFireball; }
public Flag(Vector2 position) { this.Position = position; sprite = AnimatedSpriteFactory.Instance.BuildFlagSprite(this.Position); this.YVelocity = 1.5f; this.IsMoving = false; }
public Background(int screenWidth, int screenHeight) { this.screenWidth = screenWidth; this.screenHeight = screenHeight; backgroundBlueSprite = AnimatedSpriteFactory.Instance.BuildBackgroundBlueSprite(Mario.Instance.Position, screenWidth * 2, screenHeight * 2); backgroundBlackSprite = AnimatedSpriteFactory.Instance.BuildBackgroundBlackSprite(Level.Instance.CoinRoomPosition, screenWidth * 2, screenHeight * 2); }
public Flagpole(Vector2 position, int levelCellSize) { this.levelcellsize = levelCellSize; scoreDrawn = false; ScoreSprite = new ScoreSprite(GameValues.FlagpoleMinScoreSprite, Mario.Instance.Position, false); Position = new Vector2(position.X + levelCellSize/4, position.Y); flagpole = AnimatedSpriteFactory.Instance.BuildFlagpoleSprite(Position); CollisionRectangle = new Rectangle((int)Position.X, (int)Position.Y, flagpole.Texture.Width, flagpole.Texture.Height); }
public Castle(Vector2 position) { Position = position; castleSprite = AnimatedSpriteFactory.Instance.BuildBackgroundCastleSprite(position); BoundingRectangle = castleSprite.SpriteDestinationRectangle; castleFlagSprite = AnimatedSpriteFactory.Instance.BuildCastleFlag(new Vector2(BoundingRectangle.Center.X - GameValues.CastleFlagPositionOffset.X, BoundingRectangle.Top + GameValues.CastleFlagPositionOffset.Y)); CastleFlagMoving = false; gameNextLevelBuffer = GameValues.CastleNextLevelBuffer; }
public AnimatedSprite BuildYoshiSpawningSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, yoshiSpawningTextureName, GameValues.SpriteYoshiSpawningTotalTextureFrames, 0, GameValues.SpriteAnimationYoshiSpawningTotalFrames, false, position); return sprite; }
public AnimatedSprite BuildUsedBlockSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, usedBlockTextureName, 1, 0, position); return sprite; }
public AnimatedSprite BuildSmallRightWalkingMarioYoshiSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, smallRightWalkingMarioYoshiTextureName, GameValues.SpriteSmallRightWalkingMarioYoshiTotalTextureFrames, 0, GameValues.SpriteAnimationSmallRightWalkingMarioYoshiTotalFrames, false, position); return sprite; }
public AnimatedSprite BuildSmallRightTongueXLargeMarioYoshi(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, smallRightTongueXLargeMarioYoshiTextureName, 1, 0, position); return sprite; }
public AnimatedSprite BuildSmallRightJumpingMarioSprite() { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, smallMarioTextureName, GameValues.SpriteSmallMarioTotalTextureFrames, 12, Mario.Instance.Position); return sprite; }
public AnimatedSprite BuildSmallLeftJumpingMarioYoshiSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, smallLeftJumpingMarioYoshiTextureName, 1, 0, position); return sprite; }
public AnimatedSprite BuildSmallFlagSlideEndMarioSprite() { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, smallFlagEndMarioTextureName, 1, 0, Mario.Instance.Position); return sprite; }
public AnimatedSprite BuildFireLeftWalkingMarioSprite() { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, fireMarioTextureName, GameValues.SpriteFireMarioTotalTextureFrames, 6, GameValues.SpriteAnimationRunningMarioTotalFrames, true, Mario.Instance.Position); return sprite; }
public AnimatedSprite BuildFireLeftFireballThrowingMarioSprite() { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, fireMarioTextureName, GameValues.SpriteFireMarioTotalTextureFrames, 3, Mario.Instance.Position); return sprite; }
public Hill(Vector2 position, int hillFrame) { Position = position; sprite = AnimatedSpriteFactory.Instance.BuildBackgroundHillSprite(position, hillFrame); }
public Bush(Vector2 position, int bushFrame) { Position = position; sprite = AnimatedSpriteFactory.Instance.BuildBackgroundBushSprite(position, bushFrame); }
public AnimatedSprite BuildRotatingCoinSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, rotatingCoinTextureName, 4, 0, 4, false, position); return sprite; }
public AnimatedSprite BuildFireRightIdleMarioSprite() { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, fireMarioTextureName, GameValues.SpriteFireMarioTotalTextureFrames, 8, Mario.Instance.Position); return sprite; }
public AnimatedSprite BuildSmallFlagSlideMarioSprite() { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, smallFlagMarioTextureName, GameValues.SpriteSmallFlagMarioTotalTextureFrames, 0, GameValues.SpriteSmallFlagMarioTotalTextureFrames, false, Mario.Instance.Position); return sprite; }
public AnimatedSprite BuildFloorTileSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, floorTileTextureName, 1, 0, position); return sprite; }
public AnimatedSprite BuildSmallLeftMarioToBigMarioSprite() { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, smallMarioToBigMarioTextureName, GameValues.SpriteSmallMarioToBigTotalTextureFrames, 11, GameValues.SpriteAnimationSmallMarioToBigTotalFrames, true, Mario.Instance.Position); return sprite; }
public AnimatedSprite BuildMarioLifeSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, smallMarioTextureName, GameValues.SpriteSmallMarioTotalTextureFrames, 7, position); return sprite; }
public AnimatedSprite BuildSmallRightTongueStartMarioYoshi(Vector2 position, int frame) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, smallRightTongueStartMarioYoshiTextureName, 2, frame, position); return sprite; }
public AnimatedSprite BuildMushroomSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, mushroomTextureName, GameValues.SpriteMushroomTotalTextureFrames, 1, position); return sprite; }
public AnimatedSprite BuildSmallRightWalkingMarioSprite() { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, smallMarioTextureName, GameValues.SpriteSmallMarioTotalTextureFrames, 8, GameValues.SpriteAnimationRunningMarioTotalFrames, false, Mario.Instance.Position); return sprite; }
public AnimatedSprite BuildPeachSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, peachTextureName, 1, 0, position); return sprite; }
public AnimatedSprite BuildStarSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, starTextureName, 4, 0, 4, false, position); return sprite; }
public AnimatedSprite BuildPipeHorizontalSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, pipeHorizontalTextureName, 1, 0, position); return sprite; }
public AnimatedSprite BuildYoshiGreenEggSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, yoshiGreenEggTextureName, 1, 0, position); return sprite; }
public AnimatedSprite BuildPipeTopSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); NonLoopingAnimation(sprite, pipeTextureName, GameValues.SpritePipeTotalTextureFrames, 0, position); return sprite; }
private void LoopingAnimation(AnimatedSprite sprite, string textureName, int textureTotalFrames, int startingFrame, int animationTotalFrames, bool leftFacing, Vector2 destinationPosition) { sprite.Texture = content.Load<Texture2D>(textureName); int width = sprite.Texture.Width / textureTotalFrames; int height = sprite.Texture.Height; if (leftFacing == true) { for (int currentFrame = startingFrame; currentFrame >= animationTotalFrames || currentFrame >= 0 && currentFrame > (startingFrame - animationTotalFrames); currentFrame--) { sprite.SpriteSourceRectangles.Add(CalculateRectangle(currentFrame * width, 0, width, height)); } sprite.SpriteDestinationRectangle = new Rectangle((int)destinationPosition.X, (int)destinationPosition.Y, width, height); } else { for (int currentFrame = startingFrame; currentFrame < (animationTotalFrames + startingFrame); currentFrame++) { sprite.SpriteSourceRectangles.Add(CalculateRectangle(width * currentFrame, 0, width, sprite.Texture.Height)); } sprite.SpriteDestinationRectangle = new Rectangle((int)destinationPosition.X, (int)destinationPosition.Y, width, height); } }
public AnimatedSprite BuildQuestionBlockSprite(Vector2 position) { AnimatedSprite sprite = new AnimatedSprite(); LoopingAnimation(sprite, questionBlockTextureName, GameValues.SpriteQuestionBlockTotalTextureFrames, 0, GameValues.SpriteAnimationQuestionBlockTotalFrames, false, position); return sprite; }