mkxp-sunshine/scripts/Sprite_Footsplash.rb
Michael Shirt d403608189 Finishing footsplashes for the water room.
With these scripts the map properly loops and the footsplashes do as
well.  Footsplashes were also made bigger.
2016-10-17 15:27:52 -06:00

52 lines
1,016 B
Ruby

class Sprite_Footsplash < Sprite
def initialize(viewport, direction, x, y)
super(viewport)
y = y + 2
@direction = direction
@real_x = x * 4 * 32
@real_y = y * 4 * 32
case direction
when 2
@real_y -= 32
when 4
@real_x += 32
when 6
@real_x -= 32
when 8
@real_y += 32
end
self.zoom_x = 2
self.zoom_y = 2
self.ox = 40
self.oy = 80
self.bitmap = RPG::Cache.misc('foot_splash')
self.src_rect.set(0, 0, 80, 80)
update
end
def update
return if disposed?
self.x = (@real_x - $game_map.display_x + 3) / 4 + 16
self.y = (@real_y - $game_map.display_y + 3) / 4 + 32
self.opacity -= 6
frameIndex = 20 - (self.opacity / 13)
frameX = frameIndex % 4
frameY = frameIndex / 4
self.src_rect.set(80*frameX, 80*frameY, 80, 80)
if self.opacity == 0
dispose
end
end
def correctX(xDelta)
@real_x += xDelta*4*32
end
def correctY(yDelta)
@real_y += yDelta*4*32
end
end