Updates to animation system + rotating pokemon

Also made useful tweaks to how battleflipped works
This commit is contained in:
JappaWakka 2022-07-18 21:41:30 +02:00
parent acbf4e1b5c
commit e6a2f6eab8
7 changed files with 93 additions and 48 deletions

View File

@ -0,0 +1,54 @@
Public Class BAEntityFaceRotate
Inherits BattleAnimation3D
Dim TargetEntity As NPC
Dim TargetModel As Entity = Nothing
Dim EndFaceRotation As Integer
Dim TurnSteps As Integer = 0
Dim TurnSpeed As Integer = 1
Dim TurnTime As Single = 0.0F
Dim TurnDelay As Single = 0.0F
Public Sub New(ByVal TargetEntity As NPC, 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, Optional TargetModel As Entity = Nothing)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
If EndFaceRotation = -1 Then
Me.EndFaceRotation = TargetEntity.faceRotation
Else
Me.EndFaceRotation = EndFaceRotation
End If
Me.TargetModel = TargetModel
Me.TurnSteps = TurnSteps
Me.TargetEntity = TargetEntity
Me.TurnSpeed = TurnSpeed
Me.TurnDelay = TurnDelay
End Sub
Public Overrides Sub DoActionActive()
If Me.TurnSteps > 0 Then
If Me.TurnTime <= 0.0F Then
Me.TargetEntity.faceRotation += Me.TurnSpeed
If Me.TargetEntity.faceRotation = 4 Then
Me.TargetEntity.faceRotation = 0
End If
If Me.TargetModel IsNot Nothing Then
Me.TargetModel.Rotation = Entity.GetRotationFromInteger(Me.TargetEntity.faceRotation)
End If
Me.TurnSteps -= TurnSpeed.ToPositive()
Me.TurnTime = TurnDelay
Else
TurnDelay -= 0.1F
End If
Else
If Me.TargetEntity.faceRotation <> Me.EndFaceRotation Then
Me.TargetEntity.faceRotation = Me.EndFaceRotation
If Me.TargetModel IsNot Nothing Then
Me.TargetModel.Rotation = Entity.GetRotationFromInteger(Me.EndFaceRotation)
End If
Else
Me.Ready = True
End If
End If
End Sub
End Class

View File

@ -105,21 +105,12 @@
Dim NewPosition As Vector3
If Not Position = Nothing Then
If BattleFlipped = True Then
If CurrentEntity IsNot Nothing Then
NewPosition.X = CurrentEntity.Position.X - Position.X
NewPosition.Y = CurrentEntity.Position.Y + Position.Y
NewPosition.Z = CurrentEntity.Position.Z - Position.Z
Else
NewPosition = Position
End If
Position.X *= -1
End If
If CurrentEntity IsNot Nothing Then
NewPosition = CurrentEntity.Position + Position
Else
If CurrentEntity IsNot Nothing Then
NewPosition.X = CurrentEntity.Position.X + Position.X
NewPosition.Y = CurrentEntity.Position.Y + Position.Y
NewPosition.Z = CurrentEntity.Position.Z + Position.Z
Else
NewPosition = Position
End If
NewPosition = Position
End If
Else
If CurrentEntity IsNot Nothing Then
@ -169,8 +160,12 @@
If Not BattleFlipped = Nothing Then
If BattleFlipped = True Then
DestinationX -= DestinationX * 2.0F
DestinationZ -= DestinationZ * 2.0F
DestinationX *= -1.0F
DestinationZ *= -1.0F
If SpinZ = True Then
SpinXSpeed *= -1.0F
SpinZSpeed *= -1.0F
End If
End If
End If
If CurrentEntity Is Nothing Then
@ -228,10 +223,25 @@
AnimationSequence.Add(baEntityRotate)
If RotateModel IsNot Nothing Then
Dim baModelOpacity As BAEntityRotate = New BAEntityRotate(CType(RotateModel, Entity), False, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation, DoReturn)
AnimationSequence.Add(baModelOpacity)
Dim baModelRotate As BAEntityRotate = New BAEntityRotate(CType(RotateModel, Entity), False, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation, DoReturn)
AnimationSequence.Add(baModelRotate)
End If
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)
Dim TurnNPC As NPC = Nothing
Dim TurnModel As Entity = Nothing
If CurrentEntity IsNot Nothing Then
TurnNPC = CType(CurrentEntity, NPC)
If Me.CurrentModel IsNot Nothing Then
TurnModel = Me.CurrentModel
End If
End If
Dim BAEntityFaceRotate As BAEntityFaceRotate = New BAEntityFaceRotate(TurnNPC, TurnSteps, startDelay, endDelay, EndFaceRotation, TurnSpeed, TurnDelay, TurnModel)
AnimationSequence.Add(BAEntityFaceRotate)
End Sub
Public Sub AnimationScale(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Grow As Boolean, ByVal EndSizeX As Single, ByVal EndSizeY As Single, ByVal EndSizeZ As Single, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal Anchors As String = "")
Dim ScaleEntity As Entity

View File

@ -27692,6 +27692,7 @@
</Content>
<Compile Include="Battle\BattleAnimations\BAEntityColor.vb" />
<Compile Include="Battle\BattleAnimations\BABackground.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityFaceRotate.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityRotate.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityMove.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityOpacity.vb" />

View File

@ -87,22 +87,13 @@
TextureYOffset = 32
End If
Dim FireballEntity = MoveAnimation.SpawnEntity(New Vector3(-2.0, 0.0, 0.0), TextureManager.GetTexture("Textures\Battle\Fire\FireBall", New Rectangle(0, TextureYOffset, 32, 32), ""), New Vector3(0.5F), 1.0F)
MoveAnimation.AnimationMove(FireballEntity, True, -0.05, 0.0, 0.0, 0.05, False, True, 0.0, 1.0,, -0.5)
If BattleFlip = True Then
MoveAnimation.AnimationMove(FireballEntity, True, -0.05, 0.0, 0.0, 0.05, False, True, 0.0, 1.0,, 0.5)
Else
MoveAnimation.AnimationMove(FireballEntity, True, -0.05, 0.0, 0.0, 0.05, False, True, 0.0, 1.0,, -0.5)
End If
MoveAnimation.AnimationPlaySound("Battle\Attacks\Fire\Ember_Hit", 4, 0)
Dim Fire1Position As Vector3 = New Vector3(-0.25, -0.25, -0.25)
Dim Fire3Position As Vector3 = New Vector3(0.25, -0.25, 0.25)
If BattleFlip = True Then
Fire1Position = New Vector3(-0.25, -0.25, 0.25)
Fire3Position = New Vector3(0.25, -0.25, -0.25)
End If
Dim FireEntity1 As Entity = MoveAnimation.SpawnEntity(Fire1Position, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 3, 0)
Dim FireEntity1 As Entity = MoveAnimation.SpawnEntity(New Vector3(-0.25, -0.25, -0.25), TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 3, 0)
Dim FireEntity2 As Entity = MoveAnimation.SpawnEntity(New Vector3(0, -0.25, 0), TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 3, 0)
Dim FireEntity3 As Entity = MoveAnimation.SpawnEntity(Fire3Position, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 3, 0)
Dim FireEntity3 As Entity = MoveAnimation.SpawnEntity(New Vector3(0.25, -0.25, 0.25), TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 3, 0)
MoveAnimation.AnimationChangeTexture(FireEntity1, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 32, 32, 32), ""), 3.75, 0)
MoveAnimation.AnimationChangeTexture(FireEntity2, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 32, 32, 32), ""), 3.75, 0)

View File

@ -66,12 +66,8 @@
Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, BattleFlip)
MoveAnimation.AnimationPlaySound(CStr(CurrentPokemon.Number), 0, 0,, True)
Dim SoundwaveEntity As Entity
' If BattleFlip = False Then
SoundwaveEntity = MoveAnimation.SpawnEntity(New Vector3(0.25, -0.25, 0), TextureManager.GetTexture("Textures\Battle\Normal\Growl", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 0, 1)
'Else
' SoundwaveEntity = MoveAnimation.SpawnEntity(New Vector3(-0.25, -0.25, 0), TextureManager.GetTexture("Textures\Battle\Normal\Growl", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 0, 1)
'End If
Dim SoundwaveEntity As Entity = MoveAnimation.SpawnEntity(New Vector3(0.25, -0.25, 0), TextureManager.GetTexture("Textures\Battle\Normal\Growl", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 0, 1)
MoveAnimation.AnimationChangeTexture(SoundwaveEntity, False, TextureManager.GetTexture("Textures\Battle\Normal\Growl", New Rectangle(0, 32, 32, 32), ""), 1, 1)
MoveAnimation.AnimationChangeTexture(SoundwaveEntity, False, TextureManager.GetTexture("Textures\Battle\Normal\Growl", New Rectangle(0, 0, 32, 32), ""), 2, 1)
MoveAnimation.AnimationChangeTexture(SoundwaveEntity, True, TextureManager.GetTexture("Textures\Battle\Normal\Growl", New Rectangle(0, 32, 32, 32), ""), 3, 1)

View File

@ -88,19 +88,16 @@
TextureYOffset = 16
End If
Dim Bubble1Position As Vector3 = New Vector3(-0.25, -0.25, -0.25)
Dim Bubble2Position As Vector3 = New Vector3(0, -0.25, 0)
Dim Bubble3Position As Vector3 = New Vector3(0.25, -0.25, 0.25)
If BattleFlip = True Then
Bubble1Position = New Vector3(-0.25, -0.25, 0.25)
Bubble3Position = New Vector3(0.25, -0.25, -0.25)
End If
Dim StingerEntity As Entity = MoveAnimation.SpawnEntity(New Vector3(-2.0, 0, 0.0), TextureManager.GetTexture("Textures\Battle\Poison\Stinger", New Rectangle(0, TextureYOffset, 16, 16), ""), New Vector3(0.2F), 1)
MoveAnimation.AnimationMove(StingerEntity, True, 0.0, 0.0, 0.0, 0.08, False, False, 0.0, 0.0)
MoveAnimation.AnimationPlaySound("Battle\Attacks\Poison\PoisonSting_Hit", 1, 0)
Dim Bubble1Position As Vector3 = New Vector3(-0.25, -0.25, -0.25)
Dim Bubble2Position As Vector3 = New Vector3(0, -0.25, 0)
Dim Bubble3Position As Vector3 = New Vector3(0.25, -0.25, 0.25)
Dim BubbleEntity1 As Entity = MoveAnimation.SpawnEntity(Bubble1Position, TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 0, 32, 32), ""), New Vector3(0.5F), 1, 2, 1)
MoveAnimation.AnimationChangeTexture(BubbleEntity1, False, TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 32, 32, 32), ""), 3, 1)

View File

@ -71,10 +71,6 @@
Dim WaterDrop1Position As Vector3 = New Vector3(-0.25, 0.25, -0.25)
Dim WaterDrop2Position As Vector3 = New Vector3(0, 0.25, 0)
Dim WaterDrop3Position As Vector3 = New Vector3(0.25, 0.25, 0.25)
If BattleFlip = True Then
WaterDrop1Position = New Vector3(-0.25, 0.25, 0.25)
WaterDrop3Position = New Vector3(0.25, 0.25, -0.25)
End If
Dim WaterDropEntity1 As Entity = MoveAnimation.SpawnEntity(WaterDrop1Position, TextureManager.GetTexture("Textures\Battle\Water\WaterGun", New Rectangle(0, 32, 16, 16), ""), New Vector3(0.5F), 0.75F, 5, 0)
Dim WaterDropEntity2 As Entity = MoveAnimation.SpawnEntity(WaterDrop2Position, TextureManager.GetTexture("Textures\Battle\Water\WaterGun", New Rectangle(0, 32, 16, 16), ""), New Vector3(0.5F), 0.75F, 5, 0)