Implemented flash move animation

This commit is contained in:
JappaWakka 2023-09-06 12:13:24 +02:00
parent 5747c2f1ce
commit eccda481b9
10 changed files with 98 additions and 15 deletions

View File

@ -4,19 +4,33 @@
Public TargetEntity As Entity Public TargetEntity As Entity
Public TransitionSpeed As Single = 0.01F Public TransitionSpeed As Single = 0.01F
Public TransitionSpeedOut As Single = 0.01F
Public FadeIn As Boolean = False Public FadeIn As Boolean = False
Public ReturnToFromWhenDone As Boolean = False
Public RemoveEntityAfter As Boolean = False
Public InitialColorSet As Boolean = False
Public IsReturning As Boolean = False
Public ColorTo As Vector3 = New Vector3(1.0F, 1.0F, 1.0F) Public ColorTo As Vector3 = New Vector3(1.0F, 1.0F, 1.0F)
Public ColorFrom As Vector3 = New Vector3(1.0F, 1.0F, 1.0F)
Public Sub New(ByVal Entity As Entity, ByVal TransitionSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal ColorTo As Color, Optional ByVal ColorFrom As Color = Nothing) Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeedIn As Single, ByVal ReturnToFromWhenDone As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, ByVal ColorTo As Vector3, Optional ByVal ColorFrom As Vector3 = Nothing, Optional TransitionSpeedOut As Single = -1)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter
Me.TransitionSpeed = TransitionSpeed If TransitionSpeedOut = -1 Then
Me.TransitionSpeedOut = TransitionSpeedIn
Else
Me.TransitionSpeedOut = TransitionSpeedOut
End If
Me.TransitionSpeed = TransitionSpeedIn
Me.TargetEntity = Entity Me.TargetEntity = Entity
Me.ReturnToFromWhenDone = ReturnToFromWhenDone
If Not ColorFrom = Nothing Then If Not ColorFrom = Nothing Then
TargetEntity.Color = ColorFrom.ToVector3 Me.ColorFrom = ColorFrom
Else
Me.ColorFrom = TargetEntity.Color
End If End If
Me.ColorTo = ColorTo.ToVector3 Me.ColorTo = ColorTo
Me.Visible = False Me.Visible = False
@ -24,44 +38,62 @@
End Sub End Sub
Public Overrides Sub DoActionActive() Public Overrides Sub DoActionActive()
If InitialColorSet = False Then
TargetEntity.Color = ColorFrom
InitialColorSet = True
End If
If TargetEntity.Color.X > ColorTo.X Then If TargetEntity.Color.X > ColorTo.X Then
TargetEntity.Color.X -= CByte(Me.TransitionSpeed) TargetEntity.Color.X -= Me.TransitionSpeed
If TargetEntity.Color.X <= ColorTo.X Then If TargetEntity.Color.X <= ColorTo.X Then
TargetEntity.Color.X = ColorTo.X TargetEntity.Color.X = ColorTo.X
End If End If
ElseIf TargetEntity.Color.X < ColorTo.X Then ElseIf TargetEntity.Color.X < ColorTo.X Then
TargetEntity.Color.X += CByte(Me.TransitionSpeed) TargetEntity.Color.X += Me.TransitionSpeed
If TargetEntity.Color.X >= ColorTo.X Then If TargetEntity.Color.X >= ColorTo.X Then
TargetEntity.Color.X = ColorTo.X TargetEntity.Color.X = ColorTo.X
End If End If
End If End If
If TargetEntity.Color.Y > ColorTo.Y Then If TargetEntity.Color.Y > ColorTo.Y Then
TargetEntity.Color.Y -= CByte(Me.TransitionSpeed) TargetEntity.Color.Y -= Me.TransitionSpeed
If TargetEntity.Color.Y <= ColorTo.Y Then If TargetEntity.Color.Y <= ColorTo.Y Then
TargetEntity.Color.Y = ColorTo.Y TargetEntity.Color.Y = ColorTo.Y
End If End If
ElseIf TargetEntity.Color.Y < ColorTo.Y Then ElseIf TargetEntity.Color.Y < ColorTo.Y Then
TargetEntity.Color.Y += CByte(Me.TransitionSpeed) TargetEntity.Color.Y += Me.TransitionSpeed
If TargetEntity.Color.Y >= ColorTo.Y Then If TargetEntity.Color.Y >= ColorTo.Y Then
TargetEntity.Color.Y = ColorTo.Y TargetEntity.Color.Y = ColorTo.Y
End If End If
End If End If
If TargetEntity.Color.Z > ColorTo.Z Then If TargetEntity.Color.Z > ColorTo.Z Then
TargetEntity.Color.Z -= CByte(Me.TransitionSpeed) TargetEntity.Color.Z -= Me.TransitionSpeed
If TargetEntity.Color.Z <= ColorTo.Z Then If TargetEntity.Color.Z <= ColorTo.Z Then
TargetEntity.Color.Z = ColorTo.Z TargetEntity.Color.Z = ColorTo.Z
End If End If
ElseIf TargetEntity.Color.Z < ColorTo.Z Then ElseIf TargetEntity.Color.Z < ColorTo.Z Then
TargetEntity.Color.Z += CByte(Me.TransitionSpeed) TargetEntity.Color.Z += Me.TransitionSpeed
If TargetEntity.Color.Z >= ColorTo.Z Then If TargetEntity.Color.Z >= ColorTo.Z Then
TargetEntity.Color.Z = ColorTo.Z TargetEntity.Color.Z = ColorTo.Z
End If End If
End If End If
If TargetEntity.Color = ColorTo Then If TargetEntity.Color = ColorTo Then
Me.Ready = True If ReturnToFromWhenDone = False Then
Me.Ready = True
Else
If IsReturning = False Then
ColorTo = ColorFrom
TransitionSpeed = TransitionSpeedOut
IsReturning = True
Else
Me.Ready = True
End If
End If
End If
End Sub
Public Overrides Sub DoRemoveEntity()
If Me.RemoveEntityAfter = True Then
TargetEntity.CanBeRemoved = True
End If End If
End Sub End Sub
End Class End Class

View File

@ -20,6 +20,8 @@
Me.TargetEntity = TargetEntity Me.TargetEntity = TargetEntity
Me.TurnSpeed = TurnSpeed Me.TurnSpeed = TurnSpeed
Me.TurnDelay = TurnDelay Me.TurnDelay = TurnDelay
Me.AnimationType = AnimationTypes.Rotation
End Sub End Sub
Public Overrides Sub DoActionActive() Public Overrides Sub DoActionActive()

View File

@ -20,6 +20,8 @@
Me.EndRotation = EndRotation Me.EndRotation = EndRotation
Me.TargetEntity = Entity Me.TargetEntity = Entity
Me.ReturnVector = TargetEntity.Rotation Me.ReturnVector = TargetEntity.Rotation
Me.AnimationType = AnimationTypes.Rotation
End Sub End Sub
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean) Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean)

View File

@ -11,6 +11,7 @@
Me.RemoveEntityAfter = RemoveEntityAfter Me.RemoveEntityAfter = RemoveEntityAfter
Me.TargetEntity = Entity Me.TargetEntity = Entity
Me.Texture = Texture Me.Texture = Texture
Me.AnimationType = AnimationTypes.Texture Me.AnimationType = AnimationTypes.Texture
End Sub End Sub

View File

@ -14,6 +14,7 @@
Me.Visible = False Me.Visible = False
Me.stopMusic = stopMusic Me.stopMusic = stopMusic
Me.IsPokemon = IsPokemon Me.IsPokemon = IsPokemon
AnimationType = AnimationTypes.Sound AnimationType = AnimationTypes.Sound
End Sub End Sub

View File

@ -1,4 +1,6 @@
Namespace BattleSystem Imports System.Xml
Namespace BattleSystem
Public Class AnimationQueryObject Public Class AnimationQueryObject
Inherits QueryObject Inherits QueryObject
@ -228,6 +230,34 @@
End Sub End Sub
Public Sub AnimationColor(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeedIn As Single, ByVal ReturnToFromWhenDone As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, ByVal VectorColorTo As Vector3, Optional ByVal VectorColorFrom As Vector3 = Nothing, Optional TransitionSpeedOut As Single = -1)
Dim ColorEntity As Entity
If Entity Is Nothing Then
ColorEntity = CurrentEntity
Else
ColorEntity = Entity
End If
Dim baEntityColor As BAEntityColor = New BAEntityColor(ColorEntity, RemoveEntityAfter, TransitionSpeedIn, ReturnToFromWhenDone, startDelay, endDelay, VectorColorTo, VectorColorFrom, TransitionSpeedOut)
AnimationSequence.Add(baEntityColor)
End Sub
Public Sub AnimationColor(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeedIn As Single, ByVal ReturnToFromWhenDone As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, ByVal ColorTo As Color, Optional ByVal ColorFrom As Color = Nothing, Optional TransitionSpeedOut As Single = -1)
Dim ColorEntity As Entity
If Entity Is Nothing Then
ColorEntity = CurrentEntity
Else
ColorEntity = Entity
End If
Dim VectorColorTo As Vector3 = ColorTo.ToVector3
Dim VectorColorFrom As Vector3 = Nothing
If ColorFrom <> Nothing Then
VectorColorFrom = ColorFrom.ToVector3
End If
Dim baEntityColor As BAEntityColor = New BAEntityColor(ColorEntity, RemoveEntityAfter, TransitionSpeedIn, ReturnToFromWhenDone, startDelay, endDelay, VectorColorTo, VectorColorFrom, TransitionSpeedOut)
AnimationSequence.Add(baEntityColor)
End Sub
Public Sub AnimationFade(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal startState As Single = -1.0F) Public Sub AnimationFade(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal startState As Single = -1.0F)
Dim FadeEntity As Entity Dim FadeEntity As Entity
If Entity Is Nothing Then If Entity Is Nothing Then
@ -240,6 +270,7 @@
AnimationSequence.Add(baEntityOpacity) AnimationSequence.Add(baEntityOpacity)
End Sub End Sub
Public Sub AnimationRotate(Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedX As Single, ByVal RotationSpeedY As Single, ByVal RotationSpeedZ As Single, ByVal EndRotationX As Single, ByVal EndRotationY As Single, ByVal EndRotationZ As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean) Public Sub AnimationRotate(Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedX As Single, ByVal RotationSpeedY As Single, ByVal RotationSpeedZ As Single, ByVal EndRotationX As Single, ByVal EndRotationY As Single, ByVal EndRotationZ As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean)
Dim RotateEntity As Entity Dim RotateEntity As Entity
If Entity Is Nothing Then If Entity Is Nothing Then
@ -253,7 +284,6 @@
Dim baEntityRotate As BAEntityRotate = New BAEntityRotate(RotateEntity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation, DoReturn) Dim baEntityRotate As BAEntityRotate = New BAEntityRotate(RotateEntity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation, DoReturn)
AnimationSequence.Add(baEntityRotate) AnimationSequence.Add(baEntityRotate)
End Sub End Sub
Public Sub AnimationTurnNPC(ByVal TurnSteps As Integer, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal EndFaceRotation As Integer = -1, Optional ByVal TurnSpeed As Integer = 1, Optional ByVal TurnDelay As Single = 0.25F) Public Sub AnimationTurnNPC(ByVal TurnSteps As Integer, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal EndFaceRotation As Integer = -1, Optional ByVal TurnSpeed As Integer = 1, Optional ByVal TurnDelay As Single = 0.25F)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

View File

@ -18275,6 +18275,9 @@
<Content Include="Content\Songs\wind.ogg"> <Content Include="Content\Songs\wind.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Sounds\Battle\Attacks\Electric\Flash.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Sounds\Battle\Attacks\Electric\Thunderbolt.wav"> <Content Include="Content\Sounds\Battle\Attacks\Electric\Thunderbolt.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -18419,6 +18422,9 @@
<Content Include="Content\Sounds\VoltorbFlip\WinGame.wav"> <Content Include="Content\Sounds\VoltorbFlip\WinGame.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Textures\Battle\Electric\FlashBackground.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Textures\Battle\Flying\Gust.png"> <Content Include="Content\Textures\Battle\Flying\Gust.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

View File

@ -57,6 +57,15 @@
BattleScreen.Battle.LowerStat(own, own, BattleScreen, "Accuracy", 1, "", "move:flash") BattleScreen.Battle.LowerStat(own, own, BattleScreen, "Accuracy", 1, "", "move:flash")
End Sub End Sub
Public Overrides Sub InternalOpponentPokemonMoveAnimation(ByVal BattleScreen As BattleScreen, ByVal BattleFlip As Boolean, ByVal CurrentPokemon As Pokemon, ByVal CurrentEntity As NPC)
Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, BattleFlip, True)
MoveAnimation.AnimationPlaySound("Battle\Attacks\Electric\Flash", 0.0F, 0)
MoveAnimation.AnimationBackground(TextureManager.GetTexture("Textures\Battle\Electric\FlashBackground"), 0, 0, 0.25F, 0.9F, 0.2F, 0.025F, True, 1, 0, 6)
MoveAnimation.AnimationColor(CurrentEntity, False, 0.2F, True, 0, 0, New Vector3(0.1), Nothing, 0.025F)
BattleScreen.BattleQuery.Add(MoveAnimation)
End Sub
End Class End Class
End Namespace End Namespace