Fixed BattleAnimation bug, updated moves

This commit is contained in:
JappaWakka 2023-07-28 15:51:16 +02:00
parent 6fe581dff9
commit d911935dfb
6 changed files with 83 additions and 29 deletions

View File

@ -3,6 +3,7 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public StartPosition As Vector3 Public StartPosition As Vector3
Public ReturnToStart As Vector3
Public TargetEntity As Entity Public TargetEntity As Entity
Public HalfDistance As New Vector3(0.0F) Public HalfDistance As New Vector3(0.0F)
Public DestinationDistance As New Vector3(0.0F) Public DestinationDistance As New Vector3(0.0F)
@ -21,7 +22,7 @@
Smooth Smooth
End Enum End Enum
Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Distance As Vector3, ByVal Speed As Single, ByVal BothWays As Boolean, ByVal Duration As TimeSpan, ByVal startDelay As Single, ByVal endDelay As Single, Optional MovementCurve As Integer = 0) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Distance As Vector3, ByVal Speed As Single, ByVal BothWays As Boolean, ByVal Duration As TimeSpan, ByVal startDelay As Single, ByVal endDelay As Single, Optional MovementCurve As Integer = 0, Optional ReturnToStart As Vector3 = Nothing)
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.RemoveEntityAfter = RemoveEntityAfter
Me.HalfDistance = Distance Me.HalfDistance = Distance
@ -39,6 +40,9 @@
Case Curves.Smooth Case Curves.Smooth
InterpolationSpeed = New Vector3(0.0F) InterpolationSpeed = New Vector3(0.0F)
End Select End Select
If ReturnToStart <> Nothing Then
Me.ReturnToStart = ReturnToStart
End If
Me.AnimationType = AnimationTypes.Move Me.AnimationType = AnimationTypes.Move
End Sub End Sub
@ -122,10 +126,20 @@
If CurrentDistance.X >= DestinationDistance.X Then If CurrentDistance.X >= DestinationDistance.X Then
CurrentDistance.X = DestinationDistance.X CurrentDistance.X = DestinationDistance.X
End If End If
Else ElseIf DestinationDistance.x < 0.0F Then
If CurrentDistance.X <= DestinationDistance.X Then If CurrentDistance.X <= DestinationDistance.X Then
CurrentDistance.X = DestinationDistance.X CurrentDistance.X = DestinationDistance.X
End If End If
Else
If CurrentDistance.X > DestinationDistance.X Then
If CurrentDistance.X - InterpolationSpeed.X <= DestinationDistance.X Then
CurrentDistance.X = DestinationDistance.X
End If
Else
If CurrentDistance.X + InterpolationSpeed.X >= DestinationDistance.X Then
CurrentDistance.X = DestinationDistance.X
End If
End If
End If End If
Else Else
If Date.Now < ReadyTime Then If Date.Now < ReadyTime Then
@ -144,7 +158,17 @@
End If End If
InterpolationDirection = True InterpolationDirection = True
Else Else
ReadyAxis.X = 1.0F If ReturnToStart.X = 0.0F Then
ReadyAxis.X = 1.0F
Else
If DestinationDistance.X <> 0.0F Then
DestinationDistance.X = 0.0F
InterpolationDirection = True
End If
If CurrentDistance.X = 0.0F Then
ReadyAxis.X = 1.0F
End If
End If
End If End If
End If End If
@ -163,10 +187,20 @@
If CurrentDistance.Y >= DestinationDistance.Y Then If CurrentDistance.Y >= DestinationDistance.Y Then
CurrentDistance.Y = DestinationDistance.Y CurrentDistance.Y = DestinationDistance.Y
End If End If
Else ElseIf DestinationDistance.Y < 0.0F Then
If CurrentDistance.Y <= DestinationDistance.Y Then If CurrentDistance.Y <= DestinationDistance.Y Then
CurrentDistance.Y = DestinationDistance.Y CurrentDistance.Y = DestinationDistance.Y
End If End If
Else
If CurrentDistance.Y > DestinationDistance.Y Then
If CurrentDistance.Y - InterpolationSpeed.Y <= DestinationDistance.Y Then
CurrentDistance.Y = DestinationDistance.Y
End If
Else
If CurrentDistance.Y + InterpolationSpeed.Y >= DestinationDistance.Y Then
CurrentDistance.Y = DestinationDistance.Y
End If
End If
End If End If
Else Else
If Date.Now < ReadyTime Then If Date.Now < ReadyTime Then
@ -185,7 +219,17 @@
End If End If
InterpolationDirection = True InterpolationDirection = True
Else Else
ReadyAxis.Y = 1.0F If ReturnToStart.Y = 0.0F Then
ReadyAxis.Y = 1.0F
Else
If DestinationDistance.Y <> 0.0F Then
DestinationDistance.Y = 0.0F
InterpolationDirection = True
End If
If CurrentDistance.Y = 0.0F Then
ReadyAxis.Y = 1.0F
End If
End If
End If End If
End If End If
@ -204,10 +248,20 @@
If CurrentDistance.Z >= DestinationDistance.Z Then If CurrentDistance.Z >= DestinationDistance.Z Then
CurrentDistance.Z = DestinationDistance.Z CurrentDistance.Z = DestinationDistance.Z
End If End If
Else ElseIf DestinationDistance.z < 0.0F Then
If CurrentDistance.Z <= DestinationDistance.Z Then If CurrentDistance.Z <= DestinationDistance.Z Then
CurrentDistance.Z = DestinationDistance.Z CurrentDistance.Z = DestinationDistance.Z
End If End If
Else
If CurrentDistance.Z > DestinationDistance.Z Then
If CurrentDistance.Z - InterpolationSpeed.Z <= DestinationDistance.Z Then
CurrentDistance.Z = DestinationDistance.Z
End If
Else
If CurrentDistance.Z + InterpolationSpeed.Z >= DestinationDistance.Z Then
CurrentDistance.Z = DestinationDistance.Z
End If
End If
End If End If
Else Else
If Date.Now < ReadyTime Then If Date.Now < ReadyTime Then
@ -226,7 +280,17 @@
End If End If
InterpolationDirection = True InterpolationDirection = True
Else Else
ReadyAxis.Z = 1.0F If ReturnToStart.Z = 0.0F Then
ReadyAxis.Z = 1.0F
Else
If DestinationDistance.Z <> 0.0F Then
DestinationDistance.Z = 0.0F
InterpolationDirection = True
End If
If CurrentDistance.Z = 0.0F Then
ReadyAxis.Z = 1.0F
End If
End If
End If End If
End If End If

View File

@ -9,6 +9,7 @@
Public AnimationSequence As List(Of BattleAnimation3D) Public AnimationSequence As List(Of BattleAnimation3D)
Public SpawnedEntities As List(Of Entity) Public SpawnedEntities As List(Of Entity)
Public CurrentEntity As Entity Public CurrentEntity As Entity
Public StartPosition As New Vector3(0)
Public DrawBeforeEntities As Boolean Public DrawBeforeEntities As Boolean
Public Overrides ReadOnly Property IsReady As Boolean Public Overrides ReadOnly Property IsReady As Boolean
@ -25,6 +26,7 @@
Me.BattleFlipped = BattleFlipped Me.BattleFlipped = BattleFlipped
If entity IsNot Nothing Then If entity IsNot Nothing Then
Me.CurrentEntity = entity Me.CurrentEntity = entity
Me.StartPosition = entity.Position
End If End If
AnimationSequenceBegin() AnimationSequenceBegin()
End Sub End Sub
@ -185,8 +187,9 @@
AnimationSequence.Add(baEntityMove) AnimationSequence.Add(baEntityMove)
End Sub End Sub
Public Sub AnimationOscillateMove(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Distance As Vector3, ByVal Speed As Single, ByVal BothWays As Boolean, ByVal Duration As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional MovementCurve As Integer = 0) Public Sub AnimationOscillateMove(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Distance As Vector3, ByVal Speed As Single, ByVal BothWays As Boolean, ByVal Duration As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional MovementCurve As Integer = 0, Optional ReturnToStart As Vector3 = Nothing)
Dim MoveEntity As Entity Dim MoveEntity As Entity
Dim ReturnPosition As New Vector3(0)
If Entity Is Nothing Then If Entity Is Nothing Then
MoveEntity = CurrentEntity MoveEntity = CurrentEntity
@ -203,7 +206,7 @@
Dim DurationWhole = CSng(Math.Truncate(CDbl(Duration))) Dim DurationWhole = CSng(Math.Truncate(CDbl(Duration)))
Dim DurationFraction = CSng((Duration - DurationWhole) * 1000) Dim DurationFraction = CSng((Duration - DurationWhole) * 1000)
Dim DurationTime As TimeSpan = New TimeSpan(0, 0, 0, CInt(DurationWhole), CInt(DurationFraction)) Dim DurationTime As TimeSpan = New TimeSpan(0, 0, 0, CInt(DurationWhole), CInt(DurationFraction))
Dim baEntityOscillateMove As BAEntityOscillateMove = New BAEntityOscillateMove(MoveEntity, RemoveEntityAfter, Distance, Speed, BothWays, DurationTime, startDelay, endDelay, MovementCurve) Dim baEntityOscillateMove As BAEntityOscillateMove = New BAEntityOscillateMove(MoveEntity, RemoveEntityAfter, Distance, Speed, BothWays, DurationTime, startDelay, endDelay, MovementCurve, ReturnToStart)
AnimationSequence.Add(baEntityOscillateMove) AnimationSequence.Add(baEntityOscillateMove)
End Sub End Sub

View File

@ -53,9 +53,8 @@
End Sub End Sub
Public Overrides Sub InternalUserPokemonMoveAnimation(ByVal BattleScreen As BattleScreen, ByVal BattleFlip As Boolean, ByVal CurrentPokemon As Pokemon, ByVal CurrentEntity As NPC) Public Overrides Sub InternalUserPokemonMoveAnimation(ByVal BattleScreen As BattleScreen, ByVal BattleFlip As Boolean, ByVal CurrentPokemon As Pokemon, ByVal CurrentEntity As NPC)
Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, BattleFlip) Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, BattleFlip)
MoveAnimation.AnimationPlaySound("Battle\Attacks\Grass\VineWhip_Start", 0.5, 2.5) MoveAnimation.AnimationPlaySound("Battle\Attacks\Grass\VineWhip_Start", 0.5, 1.25)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 0, 0.5) MoveAnimation.AnimationOscillateMove(Nothing, False, New Vector3(0, 0, -0.15), 0.035, False, 0, 0, 0, 0, New Vector3(0, 0, 1))
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.1, 0.025, False, False, 0.75, 0)
BattleScreen.BattleQuery.Add(MoveAnimation) BattleScreen.BattleQuery.Add(MoveAnimation)
End Sub End Sub

View File

@ -76,11 +76,7 @@
End Sub End Sub
Public Overrides Sub InternalOpponentPokemonMoveAnimation(ByVal BattleScreen As BattleScreen, ByVal BattleFlip As Boolean, ByVal CurrentPokemon As Pokemon, ByVal CurrentEntity As NPC) 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) Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, BattleFlip)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 0, 0.5) MoveAnimation.AnimationOscillateMove(Nothing, False, New Vector3(0, 0, 0.05), 0.035, True, 0.5, 0, 0.5, 0, New Vector3(0, 0, 1))
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.2, 0.025, False, False, 0.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.2, 0.025, False, False, 1.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.2, 0.025, False, False, 2.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 3.5, 0.5)
BattleScreen.BattleQuery.Add(MoveAnimation) BattleScreen.BattleQuery.Add(MoveAnimation)
End Sub End Sub
End Class End Class

View File

@ -64,14 +64,10 @@
Public Overrides Sub InternalUserPokemonMoveAnimation(ByVal BattleScreen As BattleScreen, ByVal BattleFlip As Boolean, ByVal CurrentPokemon As Pokemon, ByVal CurrentEntity As NPC) Public Overrides Sub InternalUserPokemonMoveAnimation(ByVal BattleScreen As BattleScreen, ByVal BattleFlip As Boolean, ByVal CurrentPokemon As Pokemon, ByVal CurrentEntity As NPC)
Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, BattleFlip) Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, BattleFlip)
MoveAnimation.AnimationTurnNPC(2, 0, 0, 1, -1) MoveAnimation.AnimationTurnNPC(2, 0, 0, 1, -1, 0.35)
MoveAnimation.AnimationPlaySound("Battle\Attacks\Normal\TailWhip", 1, 0) MoveAnimation.AnimationPlaySound("Battle\Attacks\Normal\TailWhip", 1, 0)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 1, 0.5) MoveAnimation.AnimationOscillateMove(Nothing, False, New Vector3(0, 0, -0.075), 0.035, True, 0.5, 1, 0, 0, New Vector3(0, 0, 1))
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.2, 0.025, False, False, 1.75, 0.5) MoveAnimation.AnimationTurnNPC(2, 5, 0.5, 3, 1, 0.35)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.2, 0.025, False, False, 2.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.2, 0.025, False, False, 3.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 4.5, 0.5)
MoveAnimation.AnimationTurnNPC(2, 5, 0, 3, 1)
BattleScreen.BattleQuery.Add(MoveAnimation) BattleScreen.BattleQuery.Add(MoveAnimation)
End Sub End Sub
End Class End Class

View File

@ -76,11 +76,7 @@
MoveAnimation.AnimationPlaySound("Battle\Attacks\Psychic\Psychic", 0.0F, 0) MoveAnimation.AnimationPlaySound("Battle\Attacks\Psychic\Psychic", 0.0F, 0)
MoveAnimation.AnimationBackground(TextureManager.GetTexture("Textures\Battle\Psychic\PsychicBackground"), 0, 0, 1.5F, 0.6F, 0.075F, 0.075F, True, 11, 2, 6) MoveAnimation.AnimationBackground(TextureManager.GetTexture("Textures\Battle\Psychic\PsychicBackground"), 0, 0, 1.5F, 0.6F, 0.075F, 0.075F, True, 11, 2, 6)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 1, 0.5) MoveAnimation.AnimationOscillateMove(Nothing, False, New Vector3(0, 0, 0.05), 0.035, True, 0.75, 1, 0.5, 0, New Vector3(0, 0, 1))
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.2, 0.025, False, False, 1.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.2, 0.025, False, False, 2.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.2, 0.025, False, False, 3.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 4.5, 0.5)
BattleScreen.BattleQuery.Add(MoveAnimation) BattleScreen.BattleQuery.Add(MoveAnimation)
End Sub End Sub