public override void HandleInput(InputHelper inputHelper) { base.HandleInput(inputHelper); if (backButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); ExtendedGame.GameStateManager.SwitchTo(StateName.Home); } if (selectButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); GameSettingHelper.ChangeSelectedBall(selectingBall.Id); ExtendedGame.GameStateManager.SwitchTo(StateName.Home); } if (selectLeftBallButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); SelectLeftBall(); } if (selectRightBallButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); SelectRightBall(); } }
public override void Reset() { base.Reset(); selectedBall = GameSettingHelper.GetSelectedBall(); jumpingBall = new JumpingBall(selectedBall.OriginSpritePath, 0, new Vector2(525, 720), 110, 0.2f); jumpingBall.SetOriginToCenterBottom(); }
protected override void LoadContent() { base.LoadContent(); // set a custom world and window size worldSize = new Point(700, 1200); windowSize = new Point(350, 600); // to let these settings take effect, we need to set the FullScreen property again FullScreen = false; // add the game states GameStateManager.AddGameState(StateName.Home, new HomeState()); GameStateManager.AddGameState(StateName.Play, new PlayState()); GameStateManager.AddGameState(StateName.ChangeBall, new ChangeBallState()); // start at the home screen GameStateManager.SwitchTo(StateName.Home); // hanlde volumn state bool isMuted = GameSettingHelper.GetVolumnState(); MediaPlayer.IsMuted = isMuted; SoundEffect.MasterVolume = isMuted ? 0f : 1f; // play background music AssetManager.PlaySong("Sounds/snd_music", true); }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (jumpingBall != null) { jumpingBall.Update(gameTime); } moneyText.Text = GameSettingHelper.GetMoney().ToString("N0"); }
public override void Reset() { base.Reset(); listBall = GameSettingHelper.GetListBall(); var selectedBall = GameSettingHelper.GetSelectedBall(); selectingBall = listBall.FirstOrDefault(x => x.Id == selectedBall.Id); UpdateSelectingBall(); }
public override void Show() { base.Show(); giftBox.PlayAnimation("box", true); timeEslapsed = 0f; message.Visible = false; randomBall = new RandomBall(GameSettingHelper.GetRandomBall().LargeSpritePath); glowing.Visible = false; ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_gift"); }
private void SetupEndGame() { endGameOverlay.AdditionMoney = Level; endGameOverlay.Score = Level; endGameOverlay.HighScore = GameSettingHelper.GetHighScore(); tempMoney = GameSettingHelper.GetMoney(); endGameOverlay.TotalMoney = tempMoney; GameSettingHelper.SetMoney(tempMoney + Level); endGameOverlay.Show(); }
public override void HandleInput(InputHelper inputHelper) { if (getBallOverlay.Visible) { getBallOverlay.HandleInput(inputHelper); return; } if (confirmOverlay.Visible) { confirmOverlay.HandleInput(inputHelper); return; } if (tagOverlay.Visible) { tagOverlay.HandleInput(inputHelper); return; } if (warningOverlay.Visible) { warningOverlay.HandleInput(inputHelper); return; } base.HandleInput(inputHelper); if (getBallButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); if (GameSettingHelper.GetMoney() >= 100) { confirmOverlay.Show(); } else { warningOverlay.Show(); } } if (replayButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); ExtendedGame.GameStateManager.SwitchTo(StateName.Home); } if (tagButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); tagOverlay.Show(); } }
public override void Reset() { var model = GameSettingHelper.GetSelectedBall(); spriteName = model.OriginSpritePath; speed = model.Speed; DropPosition = new Vector2(350, 1050); ballNumber = 1; Clear(); AddBall(); BallOffset = new Vector2(0, balls[0].Height) / 2; totalBall.Reset(); }
public void GameOver() { var currentMoney = GameSettingHelper.GetMoney(); if (canContinue && currentMoney >= 10) { continueOverlay.Show(); } else { SetupEndGame(); } }
public void CheckCollisionWithBall(Ball ball) { foreach (var item in items) { if (!item.Visible) { continue; } if (CollisionDetection.ShapesIntersect(item.BouncingBox, new Circle(ball.Radius, ball.GlobalCenter))) { item.Visible = false; item.PlayEffect(); GameSettingHelper.AddOneCoin(); } } }
public override void HandleInput(InputHelper inputHelper) { base.HandleInput(inputHelper); if (cancelButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); Hide(); } if (continueButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); Hide(); GameSettingHelper.SetMoney(GameSettingHelper.GetMoney() - 100); getBallOverlay.Show(); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); scoreText.Text = Score.ToString("N0"); highScoreText.Text = HighScore.ToString("N0"); int realtimeMoney = GameSettingHelper.GetMoney(); if (TotalMoney != realtimeMoney - AdditionMoney) { totalMoneyText.Text = GameSettingHelper.GetMoney().ToString("N0"); additionMoneyText.Visible = false; } else { totalMoneyText.Text = TotalMoney.ToString("N0"); additionMoneyText.Text = "+ " + AdditionMoney.ToString("N0"); } }
public void NextLevel() { Level++; if (Level > GameSettingHelper.GetHighScore()) { GameSettingHelper.SetHighScore(Level); } var blocks = GenerateNewBlocks(); ListBrick.Instance.NextLevel(blocks.Where(x => x.Type == BlockType.Brick).ToList()); ListItemAddBall.Instance.AddItems(blocks.Where(x => x.Type == BlockType.ItemAddBall).Select(x => x.Column)); ListItemAddBall.Instance.MoveDown(); ListItemAddCoin.Instance.AddItems(blocks.Where(x => x.Type == BlockType.ItemAddCoin).Select(x => x.Column)); ListItemAddCoin.Instance.MoveDown(); ListItemClearColumn.Instance.AddItems(blocks.Where(x => x.Type == BlockType.ItemClearColumn).Select(x => x.Column)); ListItemClearColumn.Instance.MoveDown(); ListItemClearRow.Instance.AddItems(blocks.Where(x => x.Type == BlockType.ItemClearRow).Select(x => x.Column)); ListItemClearRow.Instance.MoveDown(); ListItemSpreadBall.Instance.AddItems(blocks.Where(x => x.Type == BlockType.ItemSpreadBall).Select(x => x.Column)); ListItemSpreadBall.Instance.MoveDown(); }
public override void Update(GameTime gameTime) { if (endGameOverlay.Visible) { endGameOverlay.Update(gameTime); return; } if (continueOverlay.Visible) { return; } if (pauseOverlay.Visible) { return; } playScore.Text = Level.ToString("N0"); playHighScore.Text = "TOP " + GameSettingHelper.GetHighScore().ToString("N0"); playMoney.Text = GameSettingHelper.GetMoney().ToString("N0"); base.Update(gameTime); }
public override void HandleInput(InputHelper inputHelper) { base.HandleInput(inputHelper); if (continueButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); Hide(); } if (volumnButton.Pressed) { GameSettingHelper.SetVolumnState(volumnButton.Selected); MediaPlayer.IsMuted = volumnButton.Selected; SoundEffect.MasterVolume = volumnButton.Selected ? 0f : 1f; ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); } if (homeButton.Pressed) { ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click"); ExtendedGame.GameStateManager.SwitchTo(StateName.Home); } }
public override void Reset() { base.Reset(); volumnButton.Selected = GameSettingHelper.GetVolumnState(); }
public void Continue() { GameSettingHelper.SetMoney(GameSettingHelper.GetMoney() - 10); ClearDeadRows(); canContinue = false; }