A lot of progress again :D
Improved implementation of quiting Voltorb Flip minigame Properly implemented max amount of coins you can win Implemented command to start a Voltorb Flip minigame including adding won coins to the coin case afterward
This commit is contained in:
parent
8bf3c7daf3
commit
e9013a9371
|
@ -2108,6 +2108,10 @@
|
||||||
Public Sub Unload()
|
Public Sub Unload()
|
||||||
'This function clears all data from the loaded player and restores the default values.
|
'This function clears all data from the loaded player and restores the default values.
|
||||||
|
|
||||||
|
'Reset VoltorbFlipScreen's Levels
|
||||||
|
VoltorbFlip.VoltorbFlipScreen.CurrentLevel = 1
|
||||||
|
VoltorbFlip.VoltorbFlipScreen.PreviousLevel = 1
|
||||||
|
|
||||||
'Clearning lists:
|
'Clearning lists:
|
||||||
Pokemons.Clear()
|
Pokemons.Clear()
|
||||||
Pokedexes.Clear()
|
Pokedexes.Clear()
|
||||||
|
|
|
@ -28,8 +28,8 @@ Namespace VoltorbFlip
|
||||||
|
|
||||||
Public Shared GameState As States = States.Opening
|
Public Shared GameState As States = States.Opening
|
||||||
|
|
||||||
Public Property PreviousLevel As Integer = 1
|
Public Shared Property PreviousLevel As Integer = 1
|
||||||
Public Property CurrentLevel As Integer = 1
|
Public Shared Property CurrentLevel As Integer = 1
|
||||||
|
|
||||||
Public Shared ReadOnly MinLevel As Integer = 1
|
Public Shared ReadOnly MinLevel As Integer = 1
|
||||||
Public Shared ReadOnly MaxLevel As Integer = 7
|
Public Shared ReadOnly MaxLevel As Integer = 7
|
||||||
|
@ -569,7 +569,7 @@ Namespace VoltorbFlip
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Protected Overrides Function GetFontRenderer() As SpriteBatch
|
Protected Overrides Function GetFontRenderer() As SpriteBatch
|
||||||
If IsCurrentScreen() And _interfaceFade + 0.01F >= 1.0F Then
|
If IsCurrentScreen() AndAlso _interfaceFade + 0.01F >= 1.0F Then
|
||||||
Return FontRenderer
|
Return FontRenderer
|
||||||
Else
|
Else
|
||||||
Return SpriteBatch
|
Return SpriteBatch
|
||||||
|
@ -691,12 +691,12 @@ Namespace VoltorbFlip
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Quiting Voltorb Flip
|
'Quiting Voltorb Flip
|
||||||
If Controls.Dismiss And GameState = States.Game Then
|
If Controls.Dismiss AndAlso GameState = States.Game Then
|
||||||
GameState = States.QuitQuestion
|
GameState = States.QuitQuestion
|
||||||
TextBox.Show("Do you want to stop~playing Voltorb Flip?%Yes|No%")
|
TextBox.Show("Do you want to stop~playing Voltorb Flip?%Yes|No%")
|
||||||
If ChooseBox.readyForResult = True Then
|
If ChooseBox.readyForResult = True Then
|
||||||
If ChooseBox.result = 0 Then
|
If ChooseBox.result = 0 Then
|
||||||
GameState = States.Closing
|
Quit()
|
||||||
Else
|
Else
|
||||||
GameState = States.Game
|
GameState = States.Game
|
||||||
End If
|
End If
|
||||||
|
@ -705,36 +705,36 @@ Namespace VoltorbFlip
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Flip currently selected Tile
|
'Flip currently selected Tile
|
||||||
If Controls.Accept(False, True, True) And GameState = States.Game Then
|
If Controls.Accept(False, True, True) AndAlso GameState = States.Game Then
|
||||||
Board(CInt(GetCurrentTile.Y))(CInt(GetCurrentTile.X)).Flip()
|
Board(CInt(GetCurrentTile.Y))(CInt(GetCurrentTile.X)).Flip()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Flip the Tile that the mouse is on
|
'Flip the Tile that the mouse is on
|
||||||
If Controls.Accept(True, False, False) And GameState = States.Game Then
|
If Controls.Accept(True, False, False) AndAlso GameState = States.Game Then
|
||||||
Dim TileUnderMouse As Vector2 = GetTileUnderMouse()
|
Dim TileUnderMouse As Vector2 = GetTileUnderMouse()
|
||||||
BoardCursorDestination = TileUnderMouse
|
BoardCursorDestination = TileUnderMouse
|
||||||
Board(CInt(TileUnderMouse.Y))(CInt(TileUnderMouse.X)).Flip()
|
Board(CInt(TileUnderMouse.Y))(CInt(TileUnderMouse.X)).Flip()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Adding currently selected Memo to currently selected Tile
|
'Adding currently selected Memo to currently selected Tile
|
||||||
If Controls.Accept(False, True, True) And GameState = States.Memo Then
|
If Controls.Accept(False, True, True) AndAlso GameState = States.Memo Then
|
||||||
Board(CInt(GetCurrentTile.Y))(CInt(GetCurrentTile.X)).SetMemo(MemoIndex, True)
|
Board(CInt(GetCurrentTile.Y))(CInt(GetCurrentTile.X)).SetMemo(MemoIndex, True)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Adding currently selected Memo to Tile that the mouse is on
|
'Adding currently selected Memo to Tile that the mouse is on
|
||||||
If Controls.Accept(True, False, False) And GameState = States.Memo Then
|
If Controls.Accept(True, False, False) AndAlso GameState = States.Memo Then
|
||||||
Dim TileUnderMouse As Vector2 = GetTileUnderMouse()
|
Dim TileUnderMouse As Vector2 = GetTileUnderMouse()
|
||||||
BoardCursorDestination = TileUnderMouse
|
BoardCursorDestination = TileUnderMouse
|
||||||
Board(CInt(TileUnderMouse.Y))(CInt(TileUnderMouse.X)).SetMemo(MemoIndex, True)
|
Board(CInt(TileUnderMouse.Y))(CInt(TileUnderMouse.X)).SetMemo(MemoIndex, True)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Removing currently selected Memo from currently selected Tile
|
'Removing currently selected Memo from currently selected Tile
|
||||||
If Controls.Dismiss(False, True, True) And GameState = States.Memo Then
|
If Controls.Dismiss(False, True, True) AndAlso GameState = States.Memo Then
|
||||||
Board(CInt(GetCurrentTile.Y))(CInt(GetCurrentTile.X)).SetMemo(MemoIndex, False)
|
Board(CInt(GetCurrentTile.Y))(CInt(GetCurrentTile.X)).SetMemo(MemoIndex, False)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Removing currently selected Memo from Tile that the mouse is on
|
'Removing currently selected Memo from Tile that the mouse is on
|
||||||
If Controls.Dismiss(True, False, False) And GameState = States.Memo Then
|
If Controls.Dismiss(True, False, False) AndAlso GameState = States.Memo Then
|
||||||
Dim TileUnderMouse As Vector2 = GetTileUnderMouse()
|
Dim TileUnderMouse As Vector2 = GetTileUnderMouse()
|
||||||
BoardCursorDestination = TileUnderMouse
|
BoardCursorDestination = TileUnderMouse
|
||||||
Board(CInt(TileUnderMouse.Y))(CInt(TileUnderMouse.X)).SetMemo(MemoIndex, False)
|
Board(CInt(TileUnderMouse.Y))(CInt(TileUnderMouse.X)).SetMemo(MemoIndex, False)
|
||||||
|
@ -759,21 +759,33 @@ Namespace VoltorbFlip
|
||||||
AnimationCurrentCoins = 0
|
AnimationCurrentCoins = 0
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
CurrentCoins = CInt(Math.Ceiling(AnimationCurrentCoins))
|
||||||
|
|
||||||
TotalCoins = CInt(Math.Floor(AnimationTotalCoins))
|
TotalCoins = CInt(Math.Floor(AnimationTotalCoins))
|
||||||
If TotalCoins > 99999 Then
|
|
||||||
TotalCoins = 99999
|
If Core.Player.Coins + TotalCoins > 50000 Then
|
||||||
|
ResultCoins = 50000 - Core.Player.Coins
|
||||||
|
TotalCoins = ResultCoins
|
||||||
|
TextBox.Show("Your Coin Case can't fit~any more Coins!")
|
||||||
|
Quit()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
CurrentCoins = CInt(Math.Ceiling(AnimationCurrentCoins))
|
|
||||||
End While
|
End While
|
||||||
|
|
||||||
'Flip all Tiles to reveal contents
|
'Flip all Tiles to reveal contents
|
||||||
|
Dim ReadyAmount As Integer = 0
|
||||||
For _row = 0 To GridSize
|
For _row = 0 To GridSize
|
||||||
For _column = 0 To GridSize
|
For _column = 0 To GridSize
|
||||||
Board(_row)(_column).Reveal()
|
Board(_row)(_column).Reveal()
|
||||||
|
If Board(_row)(_column).FlipProgress = 0 Then
|
||||||
|
ReadyAmount += 1
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
GameState = States.FlipWon
|
|
||||||
|
If ReadyAmount = CInt(GridSize * GridSize) Then
|
||||||
|
GameState = States.FlipWon
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Revealed a Voltorb
|
'Revealed a Voltorb
|
||||||
|
@ -793,21 +805,31 @@ Namespace VoltorbFlip
|
||||||
End While
|
End While
|
||||||
|
|
||||||
'Flip all Tiles to reveal contents
|
'Flip all Tiles to reveal contents
|
||||||
|
Dim ReadyAmount As Integer = 0
|
||||||
For _row = 0 To GridSize
|
For _row = 0 To GridSize
|
||||||
For _column = 0 To GridSize
|
For _column = 0 To GridSize
|
||||||
Board(_row)(_column).Reveal()
|
Board(_row)(_column).Reveal()
|
||||||
|
If Board(_row)(_column).FlipProgress = 0 Then
|
||||||
|
ReadyAmount += 1
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
GameState = States.FlipLost
|
|
||||||
|
|
||||||
|
If ReadyAmount = CInt(GridSize * GridSize) Then
|
||||||
|
GameState = States.FlipLost
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Change Level, reset Tiles
|
'Increase Level, reset Tiles
|
||||||
If GameState = States.FlipWon Then
|
If GameState = States.FlipWon Then
|
||||||
If Controls.Accept = True And TextBox.Showing = False Then
|
Dim ReadyAmount As Integer = 0
|
||||||
For _row = 0 To GridSize
|
If Controls.Accept = True AndAlso TextBox.Showing = False Then
|
||||||
For _column = 0 To GridSize
|
For _row = 0 To GridSize - 1
|
||||||
|
For _column = 0 To GridSize - 1
|
||||||
Board(_row)(_column).Reset()
|
Board(_row)(_column).Reset()
|
||||||
|
If Board(_row)(_column).FlipProgress = 0 Then
|
||||||
|
ReadyAmount += 1
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
@ -815,8 +837,8 @@ Namespace VoltorbFlip
|
||||||
CurrentFlips = 0
|
CurrentFlips = 0
|
||||||
ConsequentWins += 1
|
ConsequentWins += 1
|
||||||
|
|
||||||
If ConsequentWins = 5 And TotalFlips >= 8 Then
|
If ConsequentWins = 5 AndAlso TotalFlips >= 8 Then
|
||||||
CurrentLevel = 8
|
CurrentLevel = MaxLevel + 1
|
||||||
Else
|
Else
|
||||||
PreviousLevel = CurrentLevel
|
PreviousLevel = CurrentLevel
|
||||||
CurrentLevel += 1
|
CurrentLevel += 1
|
||||||
|
@ -825,28 +847,32 @@ Namespace VoltorbFlip
|
||||||
CurrentLevel = MaxLevel
|
CurrentLevel = MaxLevel
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
If ReadyAmount = CInt(GridSize * GridSize) Then
|
||||||
GameState = States.NewLevel
|
GameState = States.NewLevel
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Drop Level(s), reset Tiles
|
'Drop Level, reset Tiles
|
||||||
If GameState = States.FlipLost Then
|
If GameState = States.FlipLost Then
|
||||||
If Controls.Accept = True And TextBox.Showing = False Then
|
Dim ReadyAmount As Integer = 0
|
||||||
For _row = 0 To GridSize
|
If Controls.Accept = True AndAlso TextBox.Showing = False Then
|
||||||
For _column = 0 To GridSize
|
For _row = 0 To GridSize - 1
|
||||||
|
For _column = 0 To GridSize - 1
|
||||||
Board(_row)(_column).Reset()
|
Board(_row)(_column).Reset()
|
||||||
|
If Board(_row)(_column).FlipProgress = 0 Then
|
||||||
|
ReadyAmount += 1
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
|
|
||||||
PreviousLevel = CurrentLevel
|
PreviousLevel = CurrentLevel
|
||||||
CurrentLevel = CurrentFlips.Clamp(1, CurrentLevel.Clamp(1, 7))
|
|
||||||
|
CurrentLevel = CurrentFlips.Clamp(MinLevel, CurrentLevel.Clamp(MinLevel, MaxLevel))
|
||||||
CurrentFlips = 0
|
CurrentFlips = 0
|
||||||
|
|
||||||
If CurrentLevel < MinLevel Then
|
End If
|
||||||
CurrentLevel = MinLevel
|
If ReadyAmount = CInt(GridSize * GridSize) Then
|
||||||
End If
|
|
||||||
|
|
||||||
GameState = States.NewLevel
|
GameState = States.NewLevel
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
@ -875,6 +901,18 @@ Namespace VoltorbFlip
|
||||||
|
|
||||||
'Animation of opening/closing the window
|
'Animation of opening/closing the window
|
||||||
If GameState = States.Closing Then
|
If GameState = States.Closing Then
|
||||||
|
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
|
||||||
|
|
||||||
If _interfaceFade > 0F Then
|
If _interfaceFade > 0F Then
|
||||||
_interfaceFade = MathHelper.Lerp(0, _interfaceFade, 0.8F)
|
_interfaceFade = MathHelper.Lerp(0, _interfaceFade, 0.8F)
|
||||||
If _interfaceFade < 0F Then
|
If _interfaceFade < 0F Then
|
||||||
|
@ -911,9 +949,21 @@ Namespace VoltorbFlip
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Sub Quit()
|
||||||
|
CurrentLevel = CurrentFlips.Clamp(MinLevel, CurrentLevel.Clamp(MinLevel, MaxLevel))
|
||||||
|
PreviousLevel = CurrentLevel
|
||||||
|
|
||||||
|
TextBox.Show("Game Over!~Dropped to Game Lv." & " " & CurrentLevel & "!")
|
||||||
|
|
||||||
|
CurrentFlips = 0
|
||||||
|
TotalFlips = 0
|
||||||
|
|
||||||
|
CurrentCoins = 0
|
||||||
|
|
||||||
|
GameState = States.Closing
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
|
||||||
|
@ -934,7 +984,7 @@ Namespace VoltorbFlip
|
||||||
Private Property Memo3 As Boolean = False
|
Private Property Memo3 As Boolean = False
|
||||||
|
|
||||||
Private Property Activated As Boolean = False
|
Private Property Activated As Boolean = False
|
||||||
Private Property FlipProgress As Integer = 0
|
Public Property FlipProgress As Integer = 0
|
||||||
|
|
||||||
Public Sub Flip()
|
Public Sub Flip()
|
||||||
If Flipped = False Then
|
If Flipped = False Then
|
||||||
|
@ -950,7 +1000,7 @@ Namespace VoltorbFlip
|
||||||
End Sub
|
End Sub
|
||||||
Public Sub Reset()
|
Public Sub Reset()
|
||||||
If Flipped = True Then
|
If Flipped = True Then
|
||||||
Flipped = False
|
FlipProgress = 1
|
||||||
Activated = False
|
Activated = False
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
@ -971,10 +1021,14 @@ Namespace VoltorbFlip
|
||||||
End If
|
End If
|
||||||
If FlipWidth <= 0F Then
|
If FlipWidth <= 0F Then
|
||||||
FlipWidth = 0F
|
FlipWidth = 0F
|
||||||
Flipped = True
|
If Flipped = False Then
|
||||||
|
Flipped = True
|
||||||
|
Else
|
||||||
|
Flipped = False
|
||||||
|
End If
|
||||||
FlipProgress += 1
|
FlipProgress += 1
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
If FlipProgress = 2 OrElse FlipProgress = 4 Then
|
If FlipProgress = 2 OrElse FlipProgress = 4 Then
|
||||||
If FlipWidth < 1.0F Then
|
If FlipWidth < 1.0F Then
|
||||||
FlipWidth += 0.05F
|
FlipWidth += 0.05F
|
||||||
|
|
|
@ -276,6 +276,30 @@
|
||||||
IsReady = True
|
IsReady = True
|
||||||
|
|
||||||
CanContinue = False
|
CanContinue = False
|
||||||
|
Case "voltorbflip"
|
||||||
|
If Core.Player.Inventory.GetItemAmount(54) > 0 Then
|
||||||
|
If Core.Player.Coins < 50000 Then
|
||||||
|
Core.SetScreen(New VoltorbFlip.VoltorbFlipScreen(CurrentScreen))
|
||||||
|
|
||||||
|
If CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
||||||
|
If VoltorbFlip.VoltorbFlipScreen.TotalCoins > 0 Then
|
||||||
|
Screen.TextBox.Show("You've won" & " " & VoltorbFlip.VoltorbFlipScreen.TotalCoins & " " & "Coins!")
|
||||||
|
Core.Player.Coins += VoltorbFlip.VoltorbFlipScreen.TotalCoins
|
||||||
|
VoltorbFlip.VoltorbFlipScreen.TotalCoins = 0
|
||||||
|
CanContinue = False
|
||||||
|
Else
|
||||||
|
Screen.TextBox.Show("Too bad, you didn't win~any Coins!*Better luck next time!")
|
||||||
|
End If
|
||||||
|
IsReady = True
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Screen.TextBox.Show("Your Coin Case is already full!")
|
||||||
|
IsReady = True
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Screen.TextBox.Show("You don't have a Coin Case!~Come back when you have one!")
|
||||||
|
IsReady = True
|
||||||
|
End If
|
||||||
Case "skinselection"
|
Case "skinselection"
|
||||||
If Screens.MainMenu.NewNewGameScreen.CharacterSelectionScreen.SelectedSkin <> "" Then
|
If Screens.MainMenu.NewNewGameScreen.CharacterSelectionScreen.SelectedSkin <> "" Then
|
||||||
IsReady = True
|
IsReady = True
|
||||||
|
|
Loading…
Reference in New Issue