Added psychic anim & made background anims work

and also added Ice Punch assets to project
This commit is contained in:
JappaWakka 2023-06-21 19:24:43 +02:00
parent 62fea61236
commit a386be5eb6
7 changed files with 163 additions and 66 deletions

View File

@ -2,59 +2,108 @@
Inherits BattleAnimation3D
Public TransitionSpeed As Single = 0.01F
Public FadeIn As Boolean = False
Public FadeOut As Boolean = False
Public BackgroundOpacity As Single = 1.0F
Public EndState As Single = 0.0F
Public Duration As Single = 2.0F
Public FadeInSpeed As Single = 0.01F
Public FadeOutSpeed As Single = 0.01F
Public BackgroundOpacity As Single = 0.0F
Public Texture As Texture2D
Public DoTile As Boolean = False
Public AnimationWidth As Integer = -1
Public AnimationLength As Integer = 1
Public AnimationSpeed As Integer = 16
Public AfterFadeInOpacity As Single = 1.0F
Public FadeProgress As FadeSteps = FadeSteps.FadeIn
Private DurationDate As Date
Private DurationWhole As Single
Private DurationFraction As Single
Private BackgroundAnimation As Animation
Private CurrentRectangle As New Rectangle(0, 0, 0, 0)
Private TextureScale As Integer = 4
Public Sub New(ByVal Texture As Texture2D, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, FadeOut As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal StartState As Single = 0.0F)
Public Enum FadeSteps As Integer
FadeIn
Duration
FadeOut
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)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.Texture = Texture
Me.EndState = EndState
Me.FadeIn = FadeIn
Me.FadeOut = FadeOut
Me.TransitionSpeed = TransitionSpeed
Me.Duration = Duration
Me.AfterFadeInOpacity = AfterFadeInOpacity
Me.FadeInSpeed = FadeInSpeed
Me.FadeOutSpeed = FadeOutSpeed
Me.DoTile = DoTile
Me.AnimationWidth = AnimationWidth
Me.AnimationLength = AnimationLength
DurationWhole = CSng(Math.Truncate(CDbl(Duration)))
DurationFraction = CSng((Duration - DurationWhole) * 1000)
Me.TextureScale = TextureScale
Me.BackgroundOpacity = StartState
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)
CurrentRectangle = BackgroundAnimation.TextureRectangle
Else
Me.AnimationWidth = Texture.Width
End If
Me.Visible = False
Me.AnimationType = AnimationTypes.Background
End Sub
Public Overrides Sub Render()
Dim BackgroundTarget As New RenderTarget2D(Core.GraphicsDevice, Core.windowSize.Width, Core.windowSize.Height, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8)
Core.GraphicsDevice.SetRenderTarget(BackgroundTarget)
GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent)
If Date.Now >= startDelay AndAlso Me.BackgroundOpacity > 0.0F Then
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(0, 0, windowSize.Width, windowSize.Height), New Color(255, 255, 255, CInt(255 * Me.BackgroundOpacity)))
If DoTile = False Then
Core.SpriteBatch.Draw(Texture, New Rectangle(0, 0, windowSize.Width, windowSize.Height), CurrentRectangle, New Color(255, 255, 255, CInt(255 * Me.BackgroundOpacity)))
Else
For Dx = 0 To Core.windowSize.Width Step AnimationWidth
For Dy = 0 To Core.windowSize.Height Step Texture.Height
Core.SpriteBatch.Draw(Texture, New Rectangle(Dx * TextureScale, Dy * TextureScale, AnimationWidth * TextureScale, Texture.Height * TextureScale), CurrentRectangle, New Color(255, 255, 255, CInt(255 * Me.BackgroundOpacity)))
Next
Next
End If
End If
Core.GraphicsDevice.SetRenderTarget(Nothing)
Core.SpriteBatch.Draw(BackgroundTarget, windowSize, New Color(255, 255, 255, CInt(255 * Me.BackgroundOpacity)))
End Sub
Public Overrides Sub DoActionActive()
If Me.FadeIn = True Then
If Me.EndState > Me.BackgroundOpacity Then
Me.BackgroundOpacity += Me.TransitionSpeed
If Me.BackgroundOpacity >= Me.EndState Then
Me.BackgroundOpacity = Me.EndState
Me.FadeIn = False
Me.EndState = 0
End If
End If
Else
If Me.FadeOut = True Then
If Me.EndState < Me.BackgroundOpacity Then
Me.BackgroundOpacity -= Me.TransitionSpeed
If Me.BackgroundOpacity <= Me.EndState Then
Me.BackgroundOpacity = Me.EndState
End If
End If
If Me.BackgroundOpacity = Me.EndState Then
Me.Ready = True
End If
Else
Me.BackgroundOpacity = Me.EndState
Me.Ready = True
If BackgroundAnimation IsNot Nothing Then
BackgroundAnimation.Update(0.005)
If CurrentRectangle <> BackgroundAnimation.TextureRectangle Then
CurrentRectangle = BackgroundAnimation.TextureRectangle
End If
End If
Select Case Me.FadeProgress
Case FadeSteps.FadeIn
If Me.AfterFadeInOpacity > Me.BackgroundOpacity Then
Me.BackgroundOpacity += Me.FadeInSpeed
If Me.BackgroundOpacity >= Me.AfterFadeInOpacity Then
DurationDate = Date.Now + New TimeSpan(0, 0, 0, CInt(DurationWhole), CInt(DurationFraction))
FadeProgress = FadeSteps.Duration
Me.BackgroundOpacity = Me.AfterFadeInOpacity
End If
End If
Case FadeSteps.Duration
If Date.Now >= DurationDate Then
FadeProgress = FadeSteps.FadeOut
End If
Case FadeSteps.FadeOut
If 0 < Me.BackgroundOpacity Then
Me.BackgroundOpacity -= Me.FadeOutSpeed
If Me.BackgroundOpacity <= 0 Then
Me.BackgroundOpacity = 0
End If
End If
If Me.BackgroundOpacity = 0 Then
Me.Ready = True
End If
End Select
End Sub
End Class

View File

@ -878,39 +878,25 @@
#End Region
Public Overrides Sub Draw()
SkyDome.Draw(45.0F)
Dim ForegroundEntities As New List(Of Entity)
For Each e As Entity In Level.Entities
If e Is OwnPokemonNPC Then
ForegroundEntities.Add(e)
End If
If e Is OppPokemonNPC Then
ForegroundEntities.Add(e)
End If
If e Is OwnTrainerNPC Then
ForegroundEntities.Add(e)
End If
If e Is OppTrainerNPC Then
ForegroundEntities.Add(e)
End If
Next
If OwnPokemonNPC IsNot Nothing Then
ForegroundEntities.Add(OwnPokemonNPC)
End If
If OppPokemonNPC IsNot Nothing Then
ForegroundEntities.Add(OppPokemonNPC)
End If
If OwnTrainerNPC IsNot Nothing Then
ForegroundEntities.Add(OwnTrainerNPC)
End If
If OppTrainerNPC IsNot Nothing Then
ForegroundEntities.Add(OppTrainerNPC)
End If
If ForegroundEntities.Count > 0 Then
ForegroundEntities = (From f In ForegroundEntities Order By f.CameraDistance Descending).ToList()
End If
Level.Draw()
World.DrawWeather(Screen.Level.World.CurrentMapWeather)
If HasToWaitPVP() = True Then
Canvas.DrawRectangle(New Rectangle(0, CInt(Core.windowSize.Height / 2 - 60), CInt(Core.windowSize.Width), 120), New Color(0, 0, 0, 150))
Dim t As String = "Waiting for the other player "
Core.SpriteBatch.DrawString(FontManager.MainFont, t.Remove(t.Length - 2, 2) & LoadingDots.Dots, New Vector2(CSng(Core.windowSize.Width / 2 - FontManager.MainFont.MeasureString(t).X / 2), CSng(Core.windowSize.Height / 2 - FontManager.MainFont.MeasureString(t).Y / 2)), Color.White)
Else
If BattleMenu.Visible = True Then
BattleMenu.Draw(Me)
End If
End If
Dim ForegroundAnimationList As New List(Of AnimationQueryObject)
Dim BackgroundAnimationList As New List(Of AnimationQueryObject)
@ -964,14 +950,36 @@ nextIndexBackground:
cQuery.Reverse()
Dim BackgroundTarget As New RenderTarget2D(Core.GraphicsDevice, Core.windowSize.Width, Core.windowSize.Height, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8)
Core.GraphicsDevice.SetRenderTarget(BackgroundTarget)
GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent)
For Each cQueryObject As QueryObject In cQuery
cQueryObject.Draw(Me)
Next
Core.GraphicsDevice.SetRenderTarget(Nothing)
Dim NPCTarget As New RenderTarget2D(Core.GraphicsDevice, Core.windowSize.Width, Core.windowSize.Height, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8)
Core.GraphicsDevice.SetRenderTarget(NPCTarget)
GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent)
For i = 0 To ForegroundEntities.Count - 1
ForegroundEntities(i).Render()
DebugDisplay.MaxVertices += ForegroundEntities(i).VertexCount
Next
Core.GraphicsDevice.SetRenderTarget(Nothing)
SkyDome.Draw(45.0F)
Level.Draw()
World.DrawWeather(Screen.Level.World.CurrentMapWeather)
Core.SpriteBatch.Draw(BackgroundTarget, windowSize, Color.White)
Core.SpriteBatch.Draw(NPCTarget, windowSize, Color.White)
Else
SkyDome.Draw(45.0F)
Level.Draw()
World.DrawWeather(Screen.Level.World.CurrentMapWeather)
End If
If ForegroundAnimationList.Count > 0 Then
Dim cIndex As Integer = 0
@ -995,6 +1003,16 @@ nextIndexForeground:
End If
'Core.SpriteBatch.DrawString(FontManager.MiniFont, "Battle system not final!", New Vector2(0, Core.windowSize.Height - 20), Color.White)
If HasToWaitPVP() = True Then
Canvas.DrawRectangle(New Rectangle(0, CInt(Core.windowSize.Height / 2 - 60), CInt(Core.windowSize.Width), 120), New Color(0, 0, 0, 150))
Dim t As String = "Waiting for the other player "
Core.SpriteBatch.DrawString(FontManager.MainFont, t.Remove(t.Length - 2, 2) & LoadingDots.Dots, New Vector2(CSng(Core.windowSize.Width / 2 - FontManager.MainFont.MeasureString(t).X / 2), CSng(Core.windowSize.Height / 2 - FontManager.MainFont.MeasureString(t).Y / 2)), Color.White)
Else
If BattleMenu.Visible = True Then
BattleMenu.Draw(Me)
End If
End If
TextBox.Draw()
If DrawColoredScreen = True Then
@ -1340,7 +1358,6 @@ nextIndex:
Else
If Not p.OriginalItem Is Nothing Then
If p.Item IsNot Nothing Then
Core.Player.Inventory.AddItem(p.OriginalItem.ID.ToString, 1)
If p.OriginalItem.IsGameModeItem = True Then
Core.Player.Inventory.AddItem(p.OriginalItem.gmID, 1)
Else

View File

@ -270,8 +270,8 @@
AnimationSequence.Add(baSound)
End Sub
Public Sub AnimationBackground(Texture As Texture2D, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal FadeOut As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal startState As Single = 0.0F)
Dim baBackground As BABackground = New BABackground(Texture, TransitionSpeed, FadeIn, FadeOut, EndState, startDelay, endDelay, startState)
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)
Dim baBackground As BABackground = New BABackground(Texture, startDelay, endDelay, Duration, AfterFadeInOpacity, FadeInSpeed, FadeOutSpeed, DoTile, AnimationWidth, AnimationLength, AnimationSpeed, Scale)
AnimationSequence.Add(baBackground)
End Sub

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -17954,6 +17954,12 @@
<Content Include="Content\Sounds\Battle\Attacks\Grass\VineWhip_Start.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Sounds\Battle\Attacks\Ice\IcePunch_Crystals.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Sounds\Battle\Attacks\Ice\IcePunch_Fist.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Sounds\Battle\Attacks\Normal\Attract.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -17984,6 +17990,9 @@
<Content Include="Content\Sounds\Battle\Attacks\Poison\PoisonSting_Start.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Sounds\Battle\Attacks\Psychic\Psychic.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Sounds\Battle\Attacks\Water\Clamp.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -18062,6 +18071,12 @@
<Content Include="Content\Textures\Battle\Grass\VineWhip.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Textures\Battle\Ice\IcePunch_Crystals.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Textures\Battle\Ice\IcePunch_Fist.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Textures\Battle\MegaEvolution\Mega_Phase1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -18083,6 +18098,9 @@
<Content Include="Content\Textures\Battle\Normal\Wrap.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Textures\Battle\Psychic\PsychicBackground.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Textures\Battle\StatusEffect\Burned.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@ -71,6 +71,19 @@
End If
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\Psychic\Psychic", 0.0F, 0)
MoveAnimation.AnimationBackground(TextureManager.GetTexture("Textures\Battle\Psychic\PsychicBackground"), 0, 0, 1.5F,,,, True, 32, 11, 4, 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.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, -0.1, 0.025, False, False, 2.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0.1, 0.025, False, False, 3.75, 0.5)
MoveAnimation.AnimationMove(Nothing, False, 0, 0, 0, 0.025, False, False, 4.5, 0.5)
BattleScreen.BattleQuery.Add(MoveAnimation)
End Sub
End Class
End Namespace