diff --git a/Resources/fonts/ChunkFive-Regular.otf b/Resources/fonts/ChunkFive-Regular.otf new file mode 100644 index 000000000..7711f20f9 Binary files /dev/null and b/Resources/fonts/ChunkFive-Regular.otf differ diff --git a/Resources/images/Cards.png b/Resources/images/Cards.png index a2a97b70a..a22a871cf 100644 Binary files a/Resources/images/Cards.png and b/Resources/images/Cards.png differ diff --git a/src/GameLogic/Snap.cs b/src/GameLogic/Snap.cs index 42894a1a7..5981d74ae 100644 --- a/src/GameLogic/Snap.cs +++ b/src/GameLogic/Snap.cs @@ -37,6 +37,7 @@ public class Snap public Snap () { _deck = new Deck (); + _gameTimer = SwinGame.CreateTimer (); } /// @@ -91,7 +92,8 @@ public void Start() _started = true; _deck.Shuffle (); // Return the cards and shuffle - FlipNextCard (); // Flip the first card... + FlipNextCard ();// Flip the first card... + _gameTimer.Start(); } } @@ -111,6 +113,11 @@ public void FlipNextCard() /// public void Update() { + if (_gameTimer.Ticks > _flipTime) + { + _gameTimer.Reset (); + FlipNextCard (); + } //TODO: implement update to automatically slip cards! } @@ -140,9 +147,14 @@ public void PlayerHit (int player) _score[player]++; //TODO: consider playing a sound here... } + else if ( player >= 0 && player < _score.Length) + { + _score[player]--; + } // stop the game... _started = false; + _gameTimer.Stop (); } #region Snap Game Unit Tests diff --git a/src/SnapGame.cs b/src/SnapGame.cs index ec78e9072..0c5dec0ac 100644 --- a/src/SnapGame.cs +++ b/src/SnapGame.cs @@ -10,7 +10,7 @@ public static void LoadResources() { Bitmap cards; cards = SwinGame.LoadBitmapNamed ("Cards", "Cards.png"); - SwinGame.BitmapSetCellDetails (cards, 82, 110, 13, 5, 53); // set the cells in the bitmap to match the cards + SwinGame.BitmapSetCellDetails (cards, 167, 250, 13, 5, 53); // set the cells in the bitmap to match the cards } /// @@ -24,8 +24,24 @@ private static void HandleUserInput(Snap myGame) if (SwinGame.KeyTyped (KeyCode.vk_SPACE)) { - myGame.FlipNextCard (); + myGame.Start (); } + if (myGame.IsStarted) +{ + if ( SwinGame.KeyTyped (KeyCode.vk_LSHIFT) && + SwinGame.KeyTyped (KeyCode.vk_RSHIFT)) + { + //TODO: add sound effects + } + else if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT)) + { + myGame.PlayerHit (0); + } + else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT)) + { + myGame.PlayerHit (1); + } +} } /// @@ -40,9 +56,15 @@ private static void DrawGame(Snap myGame) Card top = myGame.TopCard; if (top != null) { - SwinGame.DrawText ("Top Card is " + top.ToString (), Color.RoyalBlue, 0, 20); - SwinGame.DrawText ("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30); - SwinGame.DrawText ("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40); + SwinGame.DrawText ("Top Card is " + top.ToString (),Color.RoyalBlue, "GameFont", 0, 20); + + SwinGame.DrawText ("Player 1 score: " + + + myGame.Score(0), Color.RoyalBlue, "GameFont", 0, 30); + + SwinGame.DrawText ("Player 2 score: " + + + myGame.Score(1), Color.RoyalBlue, "GameFont", 0, 40); SwinGame.DrawCell (SwinGame.BitmapNamed ("Cards"), top.CardIndex, 350, 50); } else