From 732103bab85118c01190b3e192dde953b3861974 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Tue, 23 May 2023 15:11:22 +0200 Subject: [PATCH] Coin counter amount animation + row & column Font --- P3D/Screens/VoltorbFlipScreen.vb | 43 +++++++++++++++--- lib/P3D.ContentPipeline/Content/Content.mgcb | 9 ++++ .../Content/Fonts/BMP/VoltorbFlipFont.png | Bin 0 -> 448 bytes .../Content/Fonts/BMP/VoltorbFlipFont.txt | 1 + .../P3D.ContentPipeline.csproj | 2 + 5 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.png create mode 100644 lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.txt diff --git a/P3D/Screens/VoltorbFlipScreen.vb b/P3D/Screens/VoltorbFlipScreen.vb index d1edaa8ab..7f729a842 100644 --- a/P3D/Screens/VoltorbFlipScreen.vb +++ b/P3D/Screens/VoltorbFlipScreen.vb @@ -19,7 +19,7 @@ Namespace VoltorbFlip Private Shared ReadOnly GridSize As Integer = 5 Public Shared GameOrigin As New Vector2(CInt(windowSize.Width - GameSize.Width / 2), CInt(windowSize.Height / 2 - GameSize.Height / 2)) - Public Shared BoardOrigin As New Vector2(GameOrigin.X + 32, GameOrigin.Y + 32) + Public Shared BoardOrigin As New Vector2(GameOrigin.X + 32, GameOrigin.Y + 96) Private BoardCursorPosition As New Vector2(0, 0) Private BoardCursorDestination As New Vector2(0, 0) @@ -684,13 +684,30 @@ Namespace VoltorbFlip 'Completed the level If GameState = States.GameWon Then TextBox.Show("Game clear! You received" & " " & CurrentCoins & " " & "Coins!") - TotalCoins += CurrentCoins - If TotalCoins > 99999 Then - TotalCoins = 99999 - End If + Dim ResultCoins As Integer = TotalCoins + CurrentCoins + Dim AnimationTotalCoins As Single = TotalCoins + Dim AnimationCurrentCoins As Single = CurrentCoins + + While TotalCoins < ResultCoins + AnimationTotalCoins += 0.05F + If AnimationTotalCoins >= ResultCoins Then + AnimationTotalCoins = ResultCoins + End If + + AnimationCurrentCoins -= -0.05F + If AnimationCurrentCoins <= 0 Then + AnimationCurrentCoins = 0 + End If + + TotalCoins = CInt(Math.Floor(AnimationTotalCoins)) + If TotalCoins > 99999 Then + TotalCoins = 99999 + End If + + CurrentCoins = CInt(Math.Ceiling(AnimationCurrentCoins)) + End While - CurrentCoins = 0 'Flip all Tiles to reveal contents For _row = 0 To GridSize For _column = 0 To GridSize @@ -703,7 +720,19 @@ Namespace VoltorbFlip 'Revealed a Voltorb If GameState = States.GameLost Then TextBox.Show("Oh no! You get 0 coins") - CurrentCoins = 0 + + Dim ResultCoins As Integer = 0 + Dim AnimationCurrentCoins As Single = CurrentCoins + + While CurrentCoins > ResultCoins + AnimationCurrentCoins -= -0.05F + If AnimationCurrentCoins <= 0 Then + AnimationCurrentCoins = 0 + End If + + CurrentCoins = CInt(Math.Ceiling(AnimationCurrentCoins)) + End While + 'Flip all Tiles to reveal contents For _row = 0 To GridSize For _column = 0 To GridSize diff --git a/lib/P3D.ContentPipeline/Content/Content.mgcb b/lib/P3D.ContentPipeline/Content/Content.mgcb index 93eb94ea9..a309be504 100644 --- a/lib/P3D.ContentPipeline/Content/Content.mgcb +++ b/lib/P3D.ContentPipeline/Content/Content.mgcb @@ -88,6 +88,15 @@ /processorParam:TextureFormat=Color /build:Fonts/BMP/Unown.png +#begin Fonts/BMP/VoltorbFlipFont.png +/importer:TextureImporter +/processor:LocalizedFontTextureProcessor +/processorParam:DefaultCharacter=? +/processorParam:FirstCharacter= +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Color +/build:Fonts/BMP/VoltorbFlipFont.png + #begin Models/BattlePike/BattlePike.fbx /importer:FbxImporter /processor:ModelProcessor diff --git a/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.png b/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.png new file mode 100644 index 0000000000000000000000000000000000000000..defd4d5388db4d3eafd166188db7bf81b0780f18 GIT binary patch literal 448 zcmeAS@N?(olHy`uVBq!ia0vp^mw{M~gAGW=MXW0ZQk(@IkwBX7FbFdq&tH)O6qGJ; zjVKAuPb(=;EJ|f?PR%K=2$<9Kbcs|my55+lYGrV}g^I2mR#fSF%>w*0eP*!$Ps zcy*BOrhj_fKATb|dOD|0?DW}m!XzT6#z*q>tJW;b*`oUYt?lm@W@O&6KIT=rG$mFw z_?e2^!nSj#UN!Ugh#uP!D>n0lN_OJRUzgW^KQ$%NyDZE{B0257*4k#F$dsz-+rOU+ zQC$7%&i||DrW7(>ymzHw*|cv@8N8QS7W*$tGID+NsDq35@1^w`Vc}DY6Rp2oP`G?v zc>Cj2H`ke3u__ZaBbUW}(24L})^qRd1kKIsE?fW93xDjrKU=(>byrgQE7$8G%EB{G zY}x1&J}3AW+x#slC#S?-?=kE<6_VFuS29&qTNCEBwQ9l*$?GO^DhNBMHTW=qLIcEP e00oTBdFIPs7hT>VdXp6x`V5|~elF{r5}E+sNxZB8 literal 0 HcmV?d00001 diff --git a/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.txt b/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.txt new file mode 100644 index 000000000..72faafdcb --- /dev/null +++ b/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.txt @@ -0,0 +1 @@ + 0123456789 \ No newline at end of file diff --git a/lib/P3D.ContentPipeline/P3D.ContentPipeline.csproj b/lib/P3D.ContentPipeline/P3D.ContentPipeline.csproj index fddeb722e..7c2f390e9 100644 --- a/lib/P3D.ContentPipeline/P3D.ContentPipeline.csproj +++ b/lib/P3D.ContentPipeline/P3D.ContentPipeline.csproj @@ -86,6 +86,8 @@ + +