public Mario(Game1 game, Scene scene) { MarioFactory = new MarioFactory(game); currentSprite = (MarioSprite)MarioFactory.MakeProduct(1); powerupStateFactor = 0; actionStateFactor = 1; direction = 1; idle = new MarioIdleState(this); jump = new MarioJumpingState(this); walk = new MarioWalkingState(this); crouch = new MarioCrouchingState(this); fall = new MarioFallingState(this); standard = new MarioStandard(this); super = new MarioSuper(this); fire = new MarioFire(this); dead = new MarioDead(this); powerupState = standard; currentState = idle; previousState = currentState; previousSprite = currentSprite; this.game = game; this.scene = scene; gravity = scene.Gravity; isGrounded = false; points = 0; coins = 10; lives = 3; sounds = new SoundMachine(game); }
public Mario(Game1 game, int posX, int posY) { MarioFactory = new MarioFactory(game); currentSprite = (MarioSprite)MarioFactory.MakeProduct(1); powerupStateFactor = 0; actionStateFactor = 1; direction = 1; idle = new MarioIdleState(this); jump = new MarioJumpingState(this); walk = new MarioWalkingState(this); crouch = new MarioCrouchingState(this); fall = new MarioFallingState(this); standard = new MarioStandard(this); super = new MarioSuper(this); fire = new MarioFire(this); dead = new MarioDead(this); powerupState = standard; currentState = idle; previousState = currentState; previousSprite = currentSprite; marioVec.X = posX; marioVec.Y = posY; }
private void CheckBorders() { if(this.CollisionBox.Max_Y >= 600 && !(this.currentState is MarioDead)) { this.marioVec.Y = 400; lives--; currentState = dead; if (lives > 0) { Vector2 latestCheck = game.scene.FindLatestCheckpoint(); int life = lives; game.ResetCommand();//Why isn't the theme music playing? game.scene.mario.MarioVec = latestCheck; game.scene.mario.Lives = life; } else { game.scene.Mute(); sounds.PlayGameOver(); game.GameoverCommand(); } } else if(this.CollisionBox.Min_X < 0) { this.marioVec.X = 0; this.marioVel.X = 0; this.marioAccel.X = 0; } else if(this.CollisionBox.Max_X >= 4000) { this.marioVec.X = 4000 - this.CollisionBox.Width; this.marioVel.X = 0; this.marioAccel.X = 0; } }
public void ToWalk() { this.MarioAccel = new Vector2(marioAccel_X, 0); previousState = currentState; currentState = walk; previousSprite = currentSprite; }
public void ToJump() { this.MarioVel = new Vector2(marioVel_X, -36); previousState = currentState; currentState = jump; previousSprite = currentSprite; if (this.powerupState.Factor() >= 10 ) { sounds.PlayBigJump(); } else { sounds.PlaySmallJump(); } }
public void ToIdle() { previousState = currentState; currentState = idle; previousSprite = currentSprite; this.MarioVel = new Vector2(0, 0); this.MarioAccel = new Vector2(0, 0); }
public void ToFall() { previousState = currentState; currentState = fall; previousSprite = currentSprite; this.MarioAccel = new Vector2(0, 5); }
public void toDead() { currentState = dead; //How do we make time stop before reseting? // if (lives > 1) { // Vector2 latestCheck = game.scene.FindLatestCheckpoint(); // int life = lives; // game.ResetCommand();//Why isn't the theme music playing? // game.scene.mario.MarioVec = latestCheck; // game.scene.mario.Lives = life; // } //else { // game.scene.Mute(); // sounds.PlayGameOver(); // game.GameoverCommand(); // } }
public void ToCrouch() { previousState = currentState; currentState = crouch; previousSprite = currentSprite; }
public void ToWalk() { previousState = currentState; currentState = walk; previousSprite = currentSprite; }
public void ToJump() { previousState = currentState; currentState = jump; previousSprite = currentSprite; }
public void ToIdle() { previousState = currentState; currentState = idle; previousSprite = currentSprite; }
public void toFall() { previousState = currentState; currentState = fall; previousSprite = currentSprite; }
public void toDead() { currentState = dead; }