Prepared funcionality for sparkling mega stones

This commit is contained in:
CaptainSegis 2018-01-21 14:38:05 -05:00
parent f046a5ec1d
commit bc24c67bae
3 changed files with 57 additions and 34 deletions

View File

@ -12,6 +12,7 @@
Dim AnimationPath As String = "" Dim AnimationPath As String = ""
Dim X, Y, width, height, rows, columns, animationSpeed, startRow, startColumn As Integer Dim X, Y, width, height, rows, columns, animationSpeed, startRow, startColumn As Integer
Dim CurrentRectangle As New Rectangle(0, 0, 0, 0) Dim CurrentRectangle As New Rectangle(0, 0, 0, 0)
Dim CanInteractWith As Boolean = True
Public Overloads Sub Initialize(Optional ByVal AnimationData As List(Of List(Of Integer)) = Nothing) Public Overloads Sub Initialize(Optional ByVal AnimationData As List(Of List(Of Integer)) = Nothing)
MyBase.Initialize() MyBase.Initialize()
@ -26,34 +27,41 @@
Me.Visible = False Me.Visible = False
Me.Collision = False Me.Collision = False
ElseIf Me.ActionValue = 2 Then ElseIf Me.ActionValue = 2 Then
Me.Visible = Visible If Core.Player.Inventory.HasMegaBracelet() Then
'sparkles Me.Visible = Visible
If AnimationData IsNot Nothing Then 'sparkles
X = AnimationData(0)(0) If AnimationData IsNot Nothing Then
Y = AnimationData(0)(1) X = AnimationData(0)(0)
width = AnimationData(0)(2) Y = AnimationData(0)(1)
height = AnimationData(0)(3) width = AnimationData(0)(2)
rows = AnimationData(0)(4) height = AnimationData(0)(3)
columns = AnimationData(0)(5) rows = AnimationData(0)(4)
animationSpeed = AnimationData(0)(6) columns = AnimationData(0)(5)
startRow = AnimationData(0)(7) animationSpeed = AnimationData(0)(6)
startColumn = AnimationData(0)(8) startRow = AnimationData(0)(7)
AnimationPath = "ItemAnimations" startColumn = AnimationData(0)(8)
Else AnimationPath = "ItemAnimations"
X = 0 Else
Y = 0 X = 0
width = 48 Y = 0
height = 48 width = 48
rows = 5 height = 48
columns = 10 rows = 5
animationSpeed = 60 columns = 10
startRow = 0 animationSpeed = 60
startColumn = 0 startRow = 0
AnimationPath = "SparkleAnimation" startColumn = 0
End If AnimationPath = "SparkleAnimation"
CreateAnimationTextureTemp() End If
CreateAnimationTextureTemp()
Me.Animation = New Animation(TextureManager.GetTexture("Textures\Routes"), rows, columns, 16, 16, animationSpeed, startRow, startColumn) Me.Animation = New Animation(TextureManager.GetTexture("Textures\Routes"), rows, columns, 16, 16, animationSpeed, startRow, startColumn)
Else
Me.Visible = False
Me.Collision = False
CanInteractWith = False
End If
End If End If
Me.NeedsUpdate = True Me.NeedsUpdate = True
@ -130,14 +138,16 @@
End Sub End Sub
Public Overrides Sub ClickFunction() Public Overrides Sub ClickFunction()
RemoveItem(Me) If CanInteractWith Then
SoundManager.PlaySound("item_found", True) RemoveItem(Me)
Screen.TextBox.TextColor = TextBox.PlayerColor SoundManager.PlaySound("item_found", True)
Screen.TextBox.Show(Core.Player.Name & " found~" & Me.Item.Name & "!*" & Core.Player.Inventory.GetMessageReceive(Item, 1), {Me}) Screen.TextBox.TextColor = TextBox.PlayerColor
Core.Player.Inventory.AddItem(Me.Item.ID, 1) Screen.TextBox.Show(Core.Player.Name & " found~" & Me.Item.Name & "!*" & Core.Player.Inventory.GetMessageReceive(Item, 1), {Me})
PlayerStatistics.Track("Items found", 1) Core.Player.Inventory.AddItem(Me.Item.ID, 1)
PlayerStatistics.Track("Items found", 1)
Core.Player.AddPoints(1, "Found an item.") Core.Player.AddPoints(1, "Found an item.")
End If
End Sub End Sub
Public Overrides Sub Render() Public Overrides Sub Render()

View File

@ -144,6 +144,19 @@ Public Class PlayerInventory
End Get End Get
End Property End Property
''' <summary>
''' If the player has the Mega Bracelet in their inventory.
''' </summary>
Public ReadOnly Property HasMegaBracelet() As Boolean
Get
If Me.GetItemAmount(576) > 0 Then
Return True
End If
Return False
End Get
End Property
''' <summary> ''' <summary>
''' Returns a message that displays the event of putting an item into the inventory. ''' Returns a message that displays the event of putting an item into the inventory.
''' </summary> ''' </summary>

Binary file not shown.