Added Poké Ball burst animation for recalling in battle, some bug fixes

This commit is contained in:
Maruno17
2022-03-16 22:44:39 +00:00
parent 93a0173fe8
commit 21f7c57905
3 changed files with 61 additions and 7 deletions

View File

@@ -204,8 +204,8 @@ class SpriteAnimation
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192) sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
case @_animation_height case @_animation_height
when 0 then sprite.z = 1 when 0 then sprite.z = 1
when 1 then sprite.z = sprite.y + 32 + 17 when 1 then sprite.z = sprite.y + (Game_Map::TILE_HEIGHT * 3 / 2) + 1
when 2 then sprite.z = sprite.y + 32 + 32 + 17 when 2 then sprite.z = sprite.y + (Game_Map::TILE_HEIGHT * 3) + 1
else sprite.z = 2000 else sprite.z = 2000
end end
sprite.ox = 96 sprite.ox = 96

View File

@@ -265,10 +265,10 @@ module Battle::Scene::Animation::BallAnimationMixin
def battlerAbsorb(battler, delay, battlerX, battlerY, color) def battlerAbsorb(battler, delay, battlerX, battlerY, color)
color.alpha = 255 color.alpha = 255
battler.moveColor(delay, 10, color) battler.moveColor(delay, 10, color) # Change color of battler to a solid shade
delay = battler.totalDuration delay = battler.totalDuration
battler.moveXY(delay, 5, battlerX, battlerY) battler.moveXY(delay, 5, battlerX, battlerY)
battler.moveZoom(delay, 5, 0) battler.moveZoom(delay, 5, 0) # Shrink battler into Poké Ball
battler.setVisible(delay + 5, false) battler.setVisible(delay + 5, false)
end end
@@ -292,7 +292,61 @@ module Battle::Scene::Animation::BallAnimationMixin
# The Poké Ball burst animation used when recalling a Pokémon. # The Poké Ball burst animation used when recalling a Pokémon.
def ballBurstRecall(delay, ball, ballX, ballY, poke_ball) def ballBurstRecall(delay, ball, ballX, ballY, poke_ball)
ball.setDelta(delay, 0, 0, [@battler.battle.scene, :pbBallBurstCommonAnimation, color_duration = 10 # Change color of battler to a solid shade - see def battlerAbsorb
[getBallBurstAnimationName(poke_ball, :recall), @battler, ballX, ballY]]) shrink_duration = 5 # Shrink battler into Poké Ball - see def battlerAbsorb
burst_duration = color_duration + shrink_duration
# Burst particles
num_particles = 5
base_angle = 55
base_radius = 64 # How far out from the Poké Ball the particles go
num_particles.times do |i|
# Set up particle
particle = addNewSprite(ballX, ballY,
"Graphics/Battle animations/ballBurst_particle", PictureOrigin::CENTER)
particle.setZ(0, 110)
particle.setZoom(0, 150)
particle.setOpacity(0, 0)
particle.setVisible(0, false)
# Particle animation
particle.setVisible(delay, true)
particle.moveOpacity(delay, 2, 255) # Fade in quickly
burst_duration.times do |j|
angle = base_angle + (i * 360 / num_particles) + (135.0 * j / burst_duration)
radian = angle * Math::PI / 180
radius = base_radius
if j < burst_duration / 5
prop = j.to_f / (color_duration / 3)
radius *= 0.75 + (prop / 4)
elsif j >= burst_duration / 2
prop = (j.to_f - burst_duration / 2) / (burst_duration / 2)
radius *= 1 - prop
end
if j == 0
particle.setXY(delay + j, ballX + radius * Math.cos(radian), ballY - radius * Math.sin(radian))
else
particle.moveXY(delay + j, 1, ballX + radius * Math.cos(radian), ballY - radius * Math.sin(radian))
end
end
particle.moveZoom(delay, burst_duration, 0.75)
particle.moveTone(delay + color_duration / 2, color_duration / 2, Tone.new(0, 0, -192, -64)) # Yellow
particle.moveTone(delay + color_duration, shrink_duration, Tone.new(0, -128, -248, -224)) # Dark orange
particle.moveOpacity(delay + color_duration, shrink_duration, 0) # Fade out at end
particle.setVisible(delay + burst_duration, false)
end
# Ring particles
ring1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_ring1", PictureOrigin::CENTER)
ring1.setZ(0, 110)
ring1.setZoom(0, 0)
ring1.setVisible(0, false)
ring2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_ring2", PictureOrigin::CENTER)
ring2.setZ(0, 110)
ring2.setVisible(0, false)
# Ring particle animations
ring1.setVisible(delay + burst_duration - 2, true)
ring1.moveZoom(delay + burst_duration - 2, 4, 100)
ring1.setVisible(delay + burst_duration + 2, false)
ring2.setVisible(delay + burst_duration + 2, true)
ring2.moveZoom(delay + burst_duration + 2, 4, 200)
ring2.moveOpacity(delay + burst_duration + 2, 4, 0)
end end
end end

View File

@@ -964,7 +964,7 @@ def animationEditorMain(animation)
viewport = Viewport.new(0, 0, Settings::SCREEN_WIDTH + 288, Settings::SCREEN_HEIGHT + 288) viewport = Viewport.new(0, 0, Settings::SCREEN_WIDTH + 288, Settings::SCREEN_HEIGHT + 288)
viewport.z = 99999 viewport.z = 99999
# Canvas # Canvas
canvas = AnimationCanvas.new(animation[animation.selected], viewport) canvas = AnimationCanvas.new(animation[animation.selected] || animation[0], viewport)
# Right hand menu # Right hand menu
sidewin = ControlWindow.new(512 + 128, 0, 160, 384 + 128) sidewin = ControlWindow.new(512 + 128, 0, 160, 384 + 128)
sidewin.addButton(_INTL("SE and BG...")) sidewin.addButton(_INTL("SE and BG..."))