mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Anim Editor: improved NumberTextBox entry, added "FoeInvertX/Y" particle properties, tidied up
This commit is contained in:
@@ -113,6 +113,18 @@ class AnimationPlayer
|
||||
particle_sprite.focus_xy = focus_xy
|
||||
particle_sprite.offset_xy = offset_xy
|
||||
particle_sprite.focus_z = focus_z
|
||||
# Set whether properties should be modified if the particle's target is on
|
||||
# the opposing side
|
||||
relative_to_index = -1
|
||||
if GameData::Animation::FOCUS_TYPES_WITH_USER.include?(particle[:focus])
|
||||
relative_to_index = @user.index
|
||||
elsif GameData::Animation::FOCUS_TYPES_WITH_TARGET.include?(particle[:focus])
|
||||
relative_to_index = target_idx
|
||||
end
|
||||
if relative_to_index >= 0 && relative_to_index.odd? && particle[:focus] != :user_and_target
|
||||
particle_sprite.foe_invert_x = particle[:foe_invert_x]
|
||||
particle_sprite.foe_invert_y = particle[:foe_invert_y]
|
||||
end
|
||||
# Find earliest command and add a "make visible" command then
|
||||
if sprite && !particle_sprite.battler_sprite?
|
||||
first_cmd = -1
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
class AnimationPlayer::ParticleSprite
|
||||
attr_accessor :sprite
|
||||
attr_accessor :focus_xy, :offset_xy, :focus_z
|
||||
attr_accessor :foe_invert_x, :foe_invert_y
|
||||
|
||||
FRAMES_PER_SECOND = 20.0
|
||||
|
||||
@@ -98,10 +99,14 @@ class AnimationPlayer::ParticleSprite
|
||||
when :blending then @sprite.blend_type = value
|
||||
when :flip then @sprite.mirror = value
|
||||
when :x
|
||||
AnimationPlayer::Helper.apply_xy_focus_to_sprite(@sprite, :x, value.round, @focus_xy)
|
||||
value = value.round
|
||||
value *= -1 if @foe_invert_x
|
||||
AnimationPlayer::Helper.apply_xy_focus_to_sprite(@sprite, :x, value, @focus_xy)
|
||||
@sprite.x += @offset_xy[0]
|
||||
when :y
|
||||
AnimationPlayer::Helper.apply_xy_focus_to_sprite(@sprite, :y, value.round, @focus_xy)
|
||||
value = value.round
|
||||
value *= -1 if @foe_invert_y
|
||||
AnimationPlayer::Helper.apply_xy_focus_to_sprite(@sprite, :y, value, @focus_xy)
|
||||
@sprite.y += @offset_xy[1]
|
||||
when :z
|
||||
AnimationPlayer::Helper.apply_z_focus_to_sprite(@sprite, value, @focus_z)
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Scene
|
||||
BETTER_ANIMATION_DEFAULTS = {
|
||||
ANIMATION_DEFAULTS = [:TACKLE, :DEFENSECURL] # With target, without target
|
||||
ANIMATION_DEFAULTS_FOR_TYPE_CATEGORY = {
|
||||
:NORMAL => [:TACKLE, :SONICBOOM, :DEFENSECURL, :EXPLOSION, :SWIFT, :TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH, :AURASPHERE, :BULKUP, nil, nil, nil],
|
||||
:FLYING => [:WINGATTACK, :GUST, :ROOST, nil, :AIRCUTTER, :FEATHERDANCE],
|
||||
@@ -73,20 +74,24 @@ class Battle::Scene
|
||||
target_data = GameData::Target.get(move_data.target)
|
||||
move_type = move_data.type
|
||||
default_idx = move_data.category
|
||||
default_idx += 3 if target_data.num_targets > 1 || target_data.affects_foe_side
|
||||
default_idx += 3 if move_data.status? && target_data.num_targets > 0
|
||||
default_idx += 3 if target_data.num_targets > 1 ||
|
||||
(target_data.num_targets > 0 && move_data.status?) ||
|
||||
target_data.affects_foe_side
|
||||
# Check for a default animation
|
||||
wanted_move = BETTER_ANIMATION_DEFAULTS[move_type][default_idx]
|
||||
wanted_move = ANIMATION_DEFAULTS_FOR_TYPE_CATEGORY[move_type][default_idx]
|
||||
anims = find_move_animation_for_move(wanted_move, 0, user_index)
|
||||
return anims if anims
|
||||
if default_idx >= 3
|
||||
wanted_move = BETTER_ANIMATION_DEFAULTS[move_type][default_idx - 3]
|
||||
wanted_move = ANIMATION_DEFAULTS_FOR_TYPE_CATEGORY[move_type][default_idx - 3]
|
||||
anims = find_move_animation_for_move(wanted_move, 0, user_index)
|
||||
return anims if anims
|
||||
return nil if wanted_move == :TACKLE # No need to check for Tackle's animation twice
|
||||
return nil if ANIMATION_DEFAULTS.include?(wanted_move) # No need to check for these animations twice
|
||||
end
|
||||
# Use Tackle's animation
|
||||
return find_move_animation_for_move(:TACKLE, 0, user_index)
|
||||
# Use Tackle or Defense Curl's animation
|
||||
if target_data.num_targets == 0 && target.data.id != :None
|
||||
return find_move_animation_for_move(ANIMATION_DEFAULTS[1], 0, user_index)
|
||||
end
|
||||
return find_move_animation_for_move(ANIMATION_DEFAULTS[0], 0, user_index)
|
||||
end
|
||||
|
||||
# Find an animation(s) for the given move_id.
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# TODO: Hardcoded animations have incorrect z values because of the change to
|
||||
# other sprites' z values.
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
Reference in New Issue
Block a user