Fixes fishing sprite offsets

This commit is contained in:
infinitefusion
2024-06-30 15:17:37 -04:00
parent 1ef1ca15d9
commit 0ba5b1551e
20 changed files with 70 additions and 52 deletions

View File

@@ -1,5 +1,8 @@
#[FRAME1 [x,y]],[FRAME2 [x,y], etc.]
#
# exact number of pixels that the sprite needs to be moved for each frame
# add 2 pixels on even frames
module Outfit_Offsets
BASE_OFFSET = [[0, 0], [0, 0], [0, 0], [0, 0]]
@@ -24,4 +27,8 @@ module Outfit_Offsets
BIKE_OFFSETS_RIGHT = [[4, -4], [2, -2], [4, -4], [6, -2]]
BIKE_OFFSETS_UP = [[0, -2], [-2, 0], [0, -2], [2, 0]]
FISH_OFFSETS_DOWN = [[0, -6], [0, -2], [0, -8], [2, -6]]
FISH_OFFSETS_LEFT = [[0, -8], [-6, -6], [0, -8], [2, -8]]
FISH_OFFSETS_RIGHT = [[0, -8], [6, -6], [0, -8], [-2, -8]]
FISH_OFFSETS_UP = [[0, -6], [0, -6], [0, -6], [2, -4]]
end

View File

@@ -72,6 +72,16 @@ class Sprite_Wearable < RPG::Sprite
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
end
when "fish"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::FISH_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::FISH_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::FISH_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::FISH_OFFSETS_UP,current_frame)
end
else
@sprite.x = @player_sprite.x - @player_sprite.ox
@sprite.y = @player_sprite.y - @player_sprite.oy
@@ -79,9 +89,10 @@ class Sprite_Wearable < RPG::Sprite
@sprite.y -= 2 if current_frame % 2 == 1
end
def animate(action)
def animate(action, frame=nil)
@action = action
current_frame = @player_sprite.character.pattern
current_frame = @player_sprite.character.pattern if !frame
direction = @player_sprite.character.direction
crop_spritesheet(direction)
set_sprite_position(@action, direction, current_frame)

View File

@@ -6,56 +6,56 @@ class Sprite_Hat < Sprite_Wearable
end
def set_sprite_position(action, direction, current_frame)
@sprite.x = @player_sprite.x - @player_sprite.ox
@sprite.y = @player_sprite.y - @player_sprite.oy
case action
when "run"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_DOWN, current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_LEFT, current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_RIGHT, current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_UP, current_frame)
end
when "surf"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_UP,current_frame)
end
when "dive"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::DIVE_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_UP,current_frame)
end
when "bike"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::BIKE_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
end
else
@sprite.x = @player_sprite.x - @player_sprite.ox
@sprite.y = @player_sprite.y - @player_sprite.oy
end
@sprite.y -= 2 if current_frame % 2 == 1
end
# def set_sprite_position(action, direction, current_frame)
# @sprite.x = @player_sprite.x - @player_sprite.ox
# @sprite.y = @player_sprite.y - @player_sprite.oy
# case action
# when "run"
# if direction == DIRECTION_DOWN
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_DOWN, current_frame)
# elsif direction == DIRECTION_LEFT
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_LEFT, current_frame)
# elsif direction == DIRECTION_RIGHT
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_RIGHT, current_frame)
# elsif direction == DIRECTION_UP
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_UP, current_frame)
# end
# when "surf"
# if direction == DIRECTION_DOWN
# apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN,current_frame)
# elsif direction == DIRECTION_LEFT
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_LEFT,current_frame)
# elsif direction == DIRECTION_RIGHT
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_RIGHT,current_frame)
# elsif direction == DIRECTION_UP
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_UP,current_frame)
# end
# when "dive"
# if direction == DIRECTION_DOWN
# apply_sprite_offset(Outfit_Offsets::DIVE_OFFSETS_DOWN,current_frame)
# elsif direction == DIRECTION_LEFT
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_LEFT,current_frame)
# elsif direction == DIRECTION_RIGHT
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_RIGHT,current_frame)
# elsif direction == DIRECTION_UP
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_UP,current_frame)
# end
# when "bike"
# if direction == DIRECTION_DOWN
# apply_sprite_offset(Outfit_Offsets::BIKE_OFFSETS_DOWN,current_frame)
# elsif direction == DIRECTION_LEFT
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_LEFT,current_frame)
# elsif direction == DIRECTION_RIGHT
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_RIGHT,current_frame)
# elsif direction == DIRECTION_UP
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
# end
# else
# @sprite.x = @player_sprite.x - @player_sprite.ox
# @sprite.y = @player_sprite.y - @player_sprite.oy
# end
# @sprite.y -= 2 if current_frame % 2 == 1
# end
end