protected virtual void HandleInput() { inputHelper.Update(); if (inputHelper.KeyPressed(Keys.Escape)) { Exit(); } if (inputHelper.KeyPressed(Keys.F5)) { FullScreen = !FullScreen; } gameWorld.HandleInput(inputHelper); }
public override void HandleInput(InputHelper inputHelper) { if (inputHelper.KeyPressed(Keys.Up)) { selectedRow--; } else if (inputHelper.KeyPressed(Keys.Down)) { selectedRow++; } selectedRow = MathHelper.Clamp(selectedRow, 0, grid.Height - 1); Position = grid.GetCellPosition(0, selectedRow); if (inputHelper.KeyPressed(Keys.Left)) { grid.ShiftRowLeft(selectedRow); } else if (inputHelper.KeyPressed(Keys.Right)) { grid.ShiftRowRight(selectedRow); } }
public override void HandleInput(InputHelper inputHelper) { if (!inputHelper.KeyPressed(Keys.Space)) { return; } int mid = Width / 2; int extraScore = 10; int combo = 0; for (int y = 0; y < Height - 2; y++) { if (IsValidCombination(grid[mid, y], grid[mid, y + 1], grid[mid, y + 2])) { RemoveJewel(mid, y, -1); RemoveJewel(mid, y + 1, -2); RemoveJewel(mid, y + 2, -3); y += 2; combo++; JewelJam.GameWorld.AddScore(extraScore); extraScore *= 2; } } if (combo == 2) { JewelJam.GameWorld.DoubleComboScored(); ExtendedGame.AssetManager.PlaySoundEffect("snd_double"); } else if (combo == 3) { JewelJam.GameWorld.TripleComboScored(); ExtendedGame.AssetManager.PlaySoundEffect("snd_triple"); } else if (combo == 1) { ExtendedGame.AssetManager.PlaySoundEffect("snd_single"); } else { ExtendedGame.AssetManager.PlaySoundEffect("snd_error"); } }