Example #1
0
 public S1UpSpawning(IPowerUp powerup)
 {
     this.Powerup     = powerup;
     this.counter     = 0;
     Powerup.Velocity = Vector2.Zero;
     SoundPanel.PlaySoundEffect(Sound.powerupappearsEffect);
 }
Example #2
0
 public SLevelPaused(Game1 game, IGameState state)
 {
     Game        = game;
     this.state  = state;
     controllers = new List <IController>();
     controllers.Add(new KeyboardCommands(Game));
     SoundPanel.PauseSong();
 }
Example #3
0
 public SCastleComplete(Game1 game, SInLevel state)
 {
     SoundPanel.PlaySong(Sound.castleComplete, false);
     this.counter = 0;
     this.Game    = game;
     this.state   = state;
     Game.state   = this;
 }
        public void Spawn()
        {
            Vine v = ((VineSpawner)Powerup).vine;

            v.Position       = new Vector2(Powerup.Position.X, Powerup.Position.Y - v.Hitbox.Height());
            Powerup.IsActive = false;

            SoundPanel.PlaySoundEffect(Sound.vineEffect);
        }
 public void CollisionRight(ITangible obj)
 {
     if (obj is BowserFireball || obj is Hammer)
     {
         ICommand c = new PowerDownPlayerCommand(subject);
         CommandScheduler.Queue(c);
     }
     if (obj is Axe)
     {
         DestroyBowserBridge();
         subject.Velocity = new Vector2(subject.Velocity.X, 0f);
         subject.AutoMove = new FinishCastleAutoMovement(subject);
     }
     if (obj is FlagpoleFlag)
     {
         subject.AutoMove = new FinishLevelAutoMovement(subject);
         SoundPanel.PlaySoundEffect(Sound.flagpoleEffect);
     }
     else if (obj is FireFlower || (obj is Mushroom && subject.State is ISmallMarioState))
     {
         ICommand c = new PowerUpPlayerCommand(subject);
         CommandScheduler.Queue(c);
         SoundPanel.PlaySoundEffect(Sound.powerupEffect);
     }
     else if (obj is Star)
     {
         ICommand c = new StarPlayerCommand(subject);
         CommandScheduler.Queue(c);
         SoundPanel.PlaySoundEffect(Sound.powerupEffect);
     }
     else if (obj is IEnemy)
     {
         if (!(obj.State is SHammerBroDead || obj.State is SKoopaShelled || obj.State is SKoopaShelledUpsideDown || obj.State is SKoopaWarning || obj.State is SKoopaWarningUpsideDown || obj.State is SGoombaStomped || obj.State is SBuzzyBeetleShelled || obj.State is SBuzzyBeetleShelledUpsideDown || obj.State is SKoopaShellMovingRight || obj.State is SKoopaUpsideDownShellMovingRight || obj.State is SBuzzyBeetleShellMovingRight || obj.State is SBuzzyBeetleUpsideDownShellMovingRight))
         {
             ICommand c = new PowerDownPlayerCommand(subject);
             CommandScheduler.Queue(c);
         }
     }
     else if (obj is IBlock && !(obj is BlockHidden && obj.State is SBlockIdle) && !(obj is LevelTransitionPoint || obj is MazeCheckpoint || obj is MazeFinish))
     {
         // handle block collision
         subject.Position = new Vector2(((IBlock)obj).Hitbox.Left() - Hitboxes.BLOCK_WIDTH + Hitboxes.SMALL_MARIO_IDLE_OFFSET_X, subject.Position.Y);
         subject.Velocity = new Vector2(0f, subject.Velocity.Y);
     }
     if (obj is IRope)
     {
         if (!(subject.State is IClimbingMarioState) && subject.State is IRightMarioState)
         {
             subject.Position = new Vector2(((IRope)obj).Hitbox.Left() - Hitboxes.SMALL_MARIO_CLIMBING_WIDTH, subject.Position.Y);
             ((IPlayerState)subject.State).Climb();
         }
         else if (obj.Hitbox.Top() - subject.Hitbox.Bottom() > -5 || subject.Hitbox.Top() - obj.Hitbox.Bottom() > -5)
         {
             subject.Position = new Vector2(subject.Position.X, subject.Position.Y + 1);
         }
     }
 }
Example #6
0
 public Fireworks(Vector2 position)
 {
     this.Position = position;
     this.Velocity = Vector2.Zero;
     this.State    = new SParticleExplosion(this, 25);
     this.Sprite   = new Animation(Textures.particleExplosion, 3, 12);
     this.IsActive = true;
     SoundPanel.PlaySoundEffect(Sound.fireworksEffect);
     HUD.SCORE[HUD.currentPlayer] += HotDAMN.SCORE_COLLECT_FIREWORK;
 }
 public void CollisionRight(ITangible type)
 {
     if (type is IPlayer)
     {
         subject.IsActive              = false;
         HUD.SCORE[HUD.currentPlayer] += HotDAMN.SCORE_COLLECT_COIN;
         HUD.COINS[HUD.currentPlayer]++;
         SoundPanel.PlaySoundEffect(Sound.coinEffect);
     }
 }
Example #8
0
 public void CollisionAbove(ITangible type)
 {
     if (type is IPlayer)
     {
         subject.IsActive = false;
         HUD.LIVES[HUD.currentPlayer]++;
         HUD.level.AddParticle(new Score(subject.Position, 0));
         SoundPanel.PlaySoundEffect(Sound.powerup1upEffect);
     }
 }
 public void CollisionRight(ITangible obj)
 {
     if ((obj is IPlayer && ((IPlayer)obj).Decorator is StarPlayer) || obj is IProjectile || (obj.State is SKoopaShellMovingLeft || obj.State is SKoopaShellMovingRight || obj.State is SKoopaUpsideDownShellMovingLeft || obj.State is SKoopaUpsideDownShellMovingRight || obj.State is SBuzzyBeetleShellMovingLeft || obj.State is SBuzzyBeetleShellMovingRight || obj.State is SBuzzyBeetleUpsideDownShellMovingLeft || obj.State is SBuzzyBeetleUpsideDownShellMovingRight))
     {
         HUD.SCORE[HUD.currentPlayer] += HotDAMN.SCORE_KILL_PIRANHAPLANT;
         HUD.level.AddParticle(new Score(subject.Position, HotDAMN.SCORE_KILL_PIRANHAPLANT));
         SoundPanel.PlaySoundEffect(Sound.kickEffect);
         subject.IsActive = false;
     }
 }
Example #10
0
        public SBowserFireballLeft(IProjectile projectile)
        {
            this.counter    = 0;
            this.Projectile = projectile;
            Projectile.Hitbox.Clear();
            SetHitbox();

            Projectile.Velocity = new Vector2(-2f, 0f);
            SoundPanel.PlaySoundEffect(Sound.bowerfireEffect);
        }
Example #11
0
        public StarPlayer(IPlayer player)
            : base(player)
        {
            this.player    = player;
            this.starFrame = 0;
            this.decoratedPlayer.CollisionHandler = new InvinciblePlayerCollisionHandler(this.decoratedPlayer);
            this.timer = 0;

            SoundPanel.PlaySong(HUD.TIME < HotDAMN.TIME_UNTIL_HURRY_UP ? Sound.hurrystarmanTheme : Sound.starmanTheme);
        }
Example #12
0
 public SCoinSpawning(IPowerUp powerup)
 {
     this.counter         = 0;
     this.Powerup         = powerup;
     Powerup.Sprite       = new Animation(Textures.powerupCoinSpinning, 4, 4);
     Powerup.Velocity     = new Vector2(0, -7f);
     Powerup.Acceleration = Physics.GRAVITY / 2;
     SoundPanel.PlaySoundEffect(Sound.coinEffect);
     HUD.COINS[HUD.currentPlayer]++;
     HUD.SCORE[HUD.currentPlayer] += HotDAMN.SCORE_COLLECT_COIN;
 }
Example #13
0
        public SBlooperDead(IEnemy enemy)
        {
            this.Enemy   = enemy;
            Enemy.Sprite = new Animation(Textures.blooperDead);

            Enemy.Hitbox.Clear();
            SetHitbox();
            Enemy.Acceleration = Physics.GRAVITY;
            counter            = 0;
            SoundPanel.PlaySoundEffect(Sound.kickEffect);
        }
        public SFireballBouncingLeft(IProjectile projectile)
        {
            this.Projectile   = projectile;
            Projectile.Sprite = new Animation(Textures.powerup1up);

            Projectile.Hitbox.Clear();
            SetHitbox();

            Projectile.Velocity = new Vector2(-6f, Projectile.Velocity.Y);
            SoundPanel.PlaySoundEffect(Sound.fireballEffect);
        }
Example #15
0
 public void CollisionRight(ITangible type)
 {
     if (!(type is IPlayer || type is IProjectile))
     {
         HUD.level.AddParticle(new Explosion(subject.Position));
         subject.IsActive = false;
         if (!(type is IEnemy))
         {
             SoundPanel.PlaySoundEffect(Sound.bumpEffect);
         }
     }
 }
        public void LevelTransition(IPlayer player)
        {
            String go = ((Vine)subject).go;

            HUD.MARIO_STATE[HUD.currentPlayer] = (IPlayerState)player.State;
            int time = HUD.TIME;

            HUD.level.game.state = new SInLevel(HUD.level.game, go);

            SoundPanel.PlaySoundEffect(Sound.vineEffect);
            HUD.TIME = time;
        }
Example #17
0
        public SGoombaStomped(IEnemy enemy)
        {
            this.Enemy   = enemy;
            Enemy.Sprite = new SettingDependentAnimation(Textures.goombaStomped);

            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity = Vector2.Zero;
            timer          = 0;
            SoundPanel.PlaySoundEffect(Sound.stompEffect);
        }
Example #18
0
        public SBulletDead(IEnemy enemy)
        {
            this.Enemy = enemy;


            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity     = new Vector2(0, -5f);
            Enemy.Acceleration = Physics.GRAVITY / 2;
            counter            = 0;
            SoundPanel.PlaySoundEffect(Sound.kickEffect);
        }
Example #19
0
        public SKoopaShelled(IEnemy enemy)
        {
            this.Enemy   = enemy;
            Enemy.Sprite = new SettingDependentAnimation(Textures.koopaInShell);

            Enemy.Hitbox.SetOffset(Hitboxes.KOOPA_SHELL_OFFSET_X, Hitboxes.KOOPA_SHELL_OFFSET_Y);
            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity = new Vector2(0, 0);
            this.timer     = 0;
            SoundPanel.PlaySoundEffect(Sound.stompEffect);
        }
Example #20
0
        public SBulletStomped(IEnemy enemy)
        {
            this.Enemy = enemy;


            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity     = Vector2.Zero;
            Enemy.Acceleration = Physics.GRAVITY;
            timer = 0;
            SoundPanel.PlaySoundEffect(Sound.stompEffect);
        }
Example #21
0
        public SGoombaDead(IEnemy enemy)
        {
            this.Enemy   = enemy;
            Enemy.Sprite = new SettingDependentAnimation(Textures.goombaDead);

            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity     = new Vector2(0, -5f);
            Enemy.Acceleration = Physics.GRAVITY / 2;
            counter            = 0;
            SoundPanel.PlaySoundEffect(Sound.kickEffect);
        }
Example #22
0
        public SLakituDead(IEnemy enemy)
        {
            this.Enemy   = enemy;
            Enemy.Sprite = new Animation(Textures.lakituDead);

            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity     = Vector2.Zero;
            Enemy.Acceleration = Physics.GRAVITY / 2;
            counter            = 0;
            SoundPanel.PlaySoundEffect(Sound.stompEffect);
        }
Example #23
0
        public SLevelIntro(Game1 game, String levelName)
        {
            SoundPanel.StopSong();
            HUD.TIME   = -1;
            Game       = game;
            Game.state = this;
            int sublevelName = levelName.IndexOf(HotDAMN.TAG_SUBLEVEL);
            int nameName     = levelName.IndexOf(HotDAMN.TAG_NAME);

            this.levelName = levelName.Substring(0, sublevelName != -1 ? sublevelName : (nameName != -1 ? nameName : levelName.Length));
            HUD.worldNum[HUD.currentPlayer] = int.Parse(levelName.Substring(0, 1));
            HUD.levelNum[HUD.currentPlayer] = int.Parse(levelName.Substring(2, 1));
        }
Example #24
0
 public SLevelComplete(Game1 game, SInLevel state)
 {
     SoundPanel.StopSong();
     this.counter   = 0;
     this.Game      = game;
     this.state     = state;
     Game.state     = this;
     this.fireworks = HUD.TIME % 10 == 1 || HUD.TIME % 10 == 3 || HUD.TIME % 10 == 6 ? HUD.TIME % 10 : 0;
     for (int i = 0; i < fireworkPos.Length; i++)
     {
         fireworkPos[i] += new Vector2(state.Level.Size.Width, 0);
     }
 }
Example #25
0
 public SMarioTansition(IPlayer player, Type newState, TextureMap newSprite)
 {
     this.oldAcceleration = player.Acceleration;
     this.oldVelocity     = player.Velocity;
     this.Player          = player;
     this.newState        = newState;
     Player.Acceleration  = Vector2.Zero;
     Player.Sprite        = new MarioAnimation(HUD.currentPlayer == 0 ? Textures.marioTransition : Textures.luigiTransition, newSprite);
     if (newSprite == Textures.bigSmallTransitionLeft || newSprite == Textures.bigSmallTransitionRight)
     {
         SoundPanel.PlaySoundEffect(Sound.pipeEffect);
     }
 }
Example #26
0
        public SSpinyDeadLeft(IEnemy enemy)
        {
            this.Enemy   = enemy;
            Enemy.Sprite = new Animation(Textures.spinyDeadLeft);

            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity     = new Vector2(0, -5f);
            Enemy.Acceleration = Physics.GRAVITY / 2;
            counter            = 0;
            SoundPanel.PlaySoundEffect(Sound.kickEffect);
        }
        public SBuzzyBeetleShelled(IEnemy enemy)
        {
            this.Enemy   = enemy;
            Enemy.Sprite = new Animation(Textures.buzzyBeetleInShell);

            Enemy.Hitbox.SetOffset(Hitboxes.BUZZYBEETLE_SHELL_OFFSET_X, Hitboxes.BUZZYBEETLE_SHELL_OFFSET_Y);
            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity = new Vector2(0, 0);
            timer          = 0;
            SoundPanel.PlaySoundEffect(Sound.stompEffect);
        }
 public void CollisionAbove(ITangible obj)
 {
     if (obj is BowserFireball || obj is Hammer)
     {
         ICommand c = new PowerDownPlayerCommand(subject);
         CommandScheduler.Queue(c);
     }
     if (obj is Axe)
     {
         DestroyBowserBridge();
         subject.Velocity = new Vector2(subject.Velocity.X, 0f);
         subject.AutoMove = new FinishCastleAutoMovement(subject);
     }
     if (obj is FlagpoleFlag)
     {
         subject.AutoMove = new FinishLevelAutoMovement(subject);
         SoundPanel.PlaySoundEffect(Sound.flagpoleEffect);
     }
     else if (obj is FireFlower || (obj is Mushroom && subject.State is ISmallMarioState))
     {
         ICommand c = new PowerUpPlayerCommand(subject);
         CommandScheduler.Queue(c);
         SoundPanel.PlaySoundEffect(Sound.powerupEffect);
     }
     else if (obj is Star)
     {
         ICommand c = new StarPlayerCommand(subject);
         CommandScheduler.Queue(c);
         SoundPanel.PlaySoundEffect(Sound.powerupEffect);
     }
     else if (obj is IEnemy)
     {
         if (!(obj.State is SHammerBroDead || obj.State is SKoopaShelled || obj.State is SKoopaShelledUpsideDown || obj.State is SGoombaStomped || obj.State is SBuzzyBeetleShelled || obj.State is SBuzzyBeetleShelledUpsideDown))
         {
             ICommand c = new PowerDownPlayerCommand(subject);
             CommandScheduler.Queue(c);
         }
     }
     else if (obj is IBlock && !(obj is LevelTransitionPoint || obj is MazeCheckpoint || obj is MazeFinish))
     {
         if (subject.State is ISmallMarioState)
         {
             subject.Position = new Vector2(subject.Position.X, ((IBlock)obj).Hitbox.Bottom() - Hitboxes.SMALL_MARIO_IDLE_OFFSET_Y);
         }
         else
         {
             subject.Position = new Vector2(subject.Position.X, ((IBlock)obj).Hitbox.Bottom() - Hitboxes.BIG_MARIO_IDLE_OFFSET_Y);
         }
         subject.Velocity = new Vector2(subject.Velocity.X, 1f);
     }
 }
Example #29
0
 public void CollisionRight(ITangible type)
 {
     if (type is IPlayer)
     {
         HUD.LIVES[HUD.currentPlayer]++;
         subject.IsActive = false;
         HUD.level.AddParticle(new Score(subject.Position, 0));
         SoundPanel.PlaySoundEffect(Sound.powerup1upEffect);
     }
     else if (!(type is IEnemy || type is IPowerUp))
     {
         subject.State = new S1UpMovingLeft(subject);
     }
 }
Example #30
0
        public SRedKoopaDead(IEnemy enemy)
        {
            this.Enemy   = enemy;
            Enemy.Sprite = new Animation(Textures.redKoopaInShellUpsideDown);

            Enemy.Hitbox.SetOffset(Hitboxes.KOOPA_SHELL_OFFSET_X, Hitboxes.KOOPA_SHELL_OFFSET_Y);
            Enemy.Hitbox.Clear();
            SetHitbox();

            Enemy.Velocity     = new Vector2(0, -5f);
            Enemy.Acceleration = Physics.GRAVITY / 2;
            counter            = 0;
            SoundPanel.PlaySoundEffect(Sound.kickEffect);
        }