#製作者:奈々(なな)
#このスクリプトは製作途中のサンプルです。作品への利用はご遠慮願います。
module Nana
module MoonPhase
#月相を格納する変数ID(イベントチェック用)
#新月を0、満月を4とし、0,1,2,3,4,5,6,7と移行する
PHASE_VAL = 0
#月相を格納する変数ID(戦闘計算用)
#新月を0、満月を100とし、0,25,50,75,100,75,50,25と移行する
MOON_VAL = 0
#月相に対応するスイッチID
#新月から順に、対応するスイッチがONに、それ以外がOFFになる
PHASE_SW = [0, 0, 0, 0, 0, 0, 0]
#マップ画面において、月相が変化する歩数
WOLK = 0
#バトル画面において、月相が変化するターン数
TURN = 0
#月グラフィックの位置(マップ画面)
# 0:左寄せ 1:中央寄せ 2:右寄せ
MAP_POS = 0
#月グラフィックの位置(バトル画面)
# 0:左寄せ 1:中央寄せ 2:右寄せ
BATTLE_POS = 0
end
end
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# システム周りのデータを扱うクラスです。セーブやメニューの禁止状態などを保存
# します。このクラスのインスタンスは $game_system で参照されます。
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :moon_phase # 月相
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias moon_initialize initialize
def initialize
moon_initialize
@moon_phase = 0
end
end
#==============================================================================
# ■ Spriteset_Map
#------------------------------------------------------------------------------
# マップ画面のスプライトやタイルマップなどをまとめたクラスです。このクラスは
# Scene_Map クラスの内部で使用されます。
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ● タイマースプライトの作成
#--------------------------------------------------------------------------
#initializeをaliasすると都合が悪いのでここに挿入
alias moon_create_timer create_timer
def create_timer
moon_create_timer
create_moon
end
#--------------------------------------------------------------------------
# ● 月相の作成
#--------------------------------------------------------------------------
def create_moon
@moon = Sprite_Moon.new(@viewport1)
@moon.z = 500
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias moon_dispose dispose
def dispose
moon_dispose
@moon.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias moon_update update
def update
moon_update
@moon.update if @moon
end
end
#==============================================================================
# ■ Sprite_Moon
#------------------------------------------------------------------------------
# 月相のスプライト。
#==============================================================================
class Sprite_Moon < Sprite
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
self.bitmap = Cache.system("Moon")
phase = $game_system.moon_phase
self.src_rect.set(phase*bitmap.width/8, 0, bitmap.width/8, bitmap.height)
pos = $game_party.in_battle ? Nana::MoonPhase::MAP_POS : Nana::MoonPhase::BATTLE_POS
case pos
when 1
self.x = (Graphics.width - self.width) / 2
when 2
self.x = Graphics.width - self.width
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
phase = $game_system.moon_phase
self.src_rect.set(phase*bitmap.width/8, 0, bitmap.width/8, bitmap.height)
end
end