Animation fixes

This commit is contained in:
JappaWakka 2023-06-26 18:18:19 +02:00
parent a005b60ad9
commit df992888a2
3 changed files with 12 additions and 6 deletions

View File

@ -26,7 +26,7 @@
FadeOut FadeOut
End Enum End Enum
Public Sub New(ByVal Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Duration As Single, Optional ByVal AfterFadeInOpacity As Single = 1.0F, Optional ByVal FadeInSpeed As Single = 0.125F, Optional ByVal FadeOutSpeed As Single = 0.125F, Optional ByVal DoTile As Boolean = False, Optional ByVal AnimationWidth As Integer = -1, Optional ByVal AnimationLength As Integer = 1, Optional ByVal AnimationSpeed As Integer = 2, Optional TextureScale As Integer = 4) Public Sub New(ByVal Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Duration As Single, Optional ByVal AfterFadeInOpacity As Single = 1.0F, Optional ByVal FadeInSpeed As Single = 0.125F, Optional ByVal FadeOutSpeed As Single = 0.125F, Optional ByVal DoTile As Boolean = False, Optional ByVal AnimationLength As Integer = 1, Optional ByVal AnimationSpeed As Integer = 2, Optional TextureScale As Integer = 4)
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.Texture = Texture Me.Texture = Texture
Me.Duration = Duration Me.Duration = Duration
@ -34,14 +34,14 @@
Me.FadeInSpeed = FadeInSpeed Me.FadeInSpeed = FadeInSpeed
Me.FadeOutSpeed = FadeOutSpeed Me.FadeOutSpeed = FadeOutSpeed
Me.DoTile = DoTile Me.DoTile = DoTile
Me.AnimationWidth = AnimationWidth Me.AnimationWidth = CInt(Texture.Width / AnimationLength)
Me.AnimationLength = AnimationLength Me.AnimationLength = AnimationLength
DurationWhole = CSng(Math.Truncate(CDbl(Duration))) DurationWhole = CSng(Math.Truncate(CDbl(Duration)))
DurationFraction = CSng((Duration - DurationWhole) * 1000) DurationFraction = CSng((Duration - DurationWhole) * 1000)
Me.TextureScale = TextureScale Me.TextureScale = TextureScale
If Me.AnimationWidth <> -1 OrElse Me.AnimationWidth <> Nothing Then If Me.AnimationWidth <> -1 OrElse Me.AnimationWidth <> Nothing Then
BackgroundAnimation = New Animation(Me.Texture, 1, CInt(Me.Texture.Width / Me.AnimationWidth), Me.AnimationWidth, Me.Texture.Height, AnimationSpeed * 24, 0, 0) BackgroundAnimation = New Animation(Me.Texture, 1, AnimationLength, Me.AnimationWidth, Me.Texture.Height, AnimationSpeed * 24, 0, 0)
CurrentRectangle = BackgroundAnimation.TextureRectangle CurrentRectangle = BackgroundAnimation.TextureRectangle
Else Else
Me.AnimationWidth = Texture.Width Me.AnimationWidth = Texture.Width

View File

@ -194,6 +194,12 @@
MoveEntity = Entity MoveEntity = Entity
End If End If
If Not BattleFlipped = Nothing Then
If BattleFlipped = True Then
Distance.Z *= -1.0F
End If
End If
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))
@ -287,8 +293,8 @@
AnimationSequence.Add(baSound) AnimationSequence.Add(baSound)
End Sub End Sub
Public Sub AnimationBackground(ByVal Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Duration As Single, Optional ByVal AfterFadeInOpacity As Single = 1.0F, Optional ByVal FadeInSpeed As Single = 0.125F, Optional ByVal FadeOutSpeed As Single = 0.125F, Optional ByVal DoTile As Boolean = False, Optional ByVal AnimationWidth As Integer = -1, Optional ByVal AnimationLength As Integer = 1, Optional ByVal AnimationSpeed As Integer = 4, Optional ByVal Scale As Integer = 4) Public Sub AnimationBackground(ByVal Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Duration As Single, Optional ByVal AfterFadeInOpacity As Single = 1.0F, Optional ByVal FadeInSpeed As Single = 0.125F, Optional ByVal FadeOutSpeed As Single = 0.125F, Optional ByVal DoTile As Boolean = False, Optional ByVal AnimationLength As Integer = 1, Optional ByVal AnimationSpeed As Integer = 4, Optional ByVal Scale As Integer = 4)
Dim baBackground As BABackground = New BABackground(Texture, startDelay, endDelay, Duration, AfterFadeInOpacity, FadeInSpeed, FadeOutSpeed, DoTile, AnimationWidth, AnimationLength, AnimationSpeed, Scale) Dim baBackground As BABackground = New BABackground(Texture, startDelay, endDelay, Duration, AfterFadeInOpacity, FadeInSpeed, FadeOutSpeed, DoTile, AnimationLength, AnimationSpeed, Scale)
AnimationSequence.Add(baBackground) AnimationSequence.Add(baBackground)
End Sub End Sub

View File

@ -74,7 +74,7 @@
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, True) Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, BattleFlip, True)
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, 32, 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.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 1, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.1, 0.025, False, False, 1.75, 0.5) MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.1, 0.025, False, False, 1.75, 0.5)