Skip to content

Instantly share code, notes, and snippets.

@rutan
Created September 21, 2013 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rutan/6651318 to your computer and use it in GitHub Desktop.
Save rutan/6651318 to your computer and use it in GitHub Desktop.
『動くメッセージウィンドウさん(仮) for RGSS3』 Tweenアニメーションのサンプルその2
#===============================================================================
# ■ 動くメッセージウィンドウさん(仮) for RGSS3
#-------------------------------------------------------------------------------
# 2013/09/21 Ru/むっくRu
#===============================================================================
class Window_Message < Window_Base
#-----------------------------------------------------------------------------
# ● ウィンドウ位置の更新(再定義)
#-----------------------------------------------------------------------------
def update_placement
@position = $game_message.position
y = @position * (Graphics.height - height) / 2
# アニメ設定が行われているか確認
if HZM_VXA::Move_Message.set?
# アニメする場合
self.x = HZM_VXA::Move_Message.x
self.y = HZM_VXA::Move_Message.y
anim_command = HZM_VXA::Tween::Animation.new(self, {
:time => HZM_VXA::Move_Message.time,
:transition => :ease_out_quad,
:x => 0,
:y => y,
})
anim_command.play
# 次回はアニメしないように初期化する
HZM_VXA::Move_Message.reset
else
# アニメしない場合
self.x = 0
self.y = y
end
@gold_window.y = y > 0 ? 0 : Graphics.height - @gold_window.height
end
end
module HZM_VXA
module Move_Message
#---------------------------------------------------------------------------
# ● アニメ開始位置の設定
# x : アニメ開始のX座標
# y : アニメ開始のY座標
# wait : アニメーション時間(フレーム)
#---------------------------------------------------------------------------
def self.set(x, y, time = 15)
@x = x
@y = y
@time = time
end
#---------------------------------------------------------------------------
# ● アニメ設定のリセット
#---------------------------------------------------------------------------
def self.reset
@x = nil
@y = nil
@time = nil
end
#---------------------------------------------------------------------------
# ● アニメ設定が行われているか?
#---------------------------------------------------------------------------
def self.set?
@x != nil and @y != nil and @time != nil
end
#---------------------------------------------------------------------------
# ● アニメ開始のX座標
#---------------------------------------------------------------------------
def self.x
@x
end
#---------------------------------------------------------------------------
# ● アニメ開始のY座標
#---------------------------------------------------------------------------
def self.y
@y
end
#---------------------------------------------------------------------------
# ● アニメーション時間(フレーム)
#---------------------------------------------------------------------------
def self.time
@time
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment