# イメージクラスに当たり判定変数追加
class Image
  attr_accessor :x1, :y1, :x2, :y2
end

# 当たり判定を設定する
def load_stgimage(filename, width = nil, height = nil, x1 = 0, y1 = 0, x2 = nil, y2 = nil)
  data = Image.load(filename, 0, 0, width, height)
  data.x1 = x1
  data.y1 = y1
  data.x2 = (x2 == nil ? data.width  - 1 : x2)
  data.y2 = (y2 == nil ? data.height - 1 : y2)
  return data
end

SE_shot           = Sound.new("sound/さる通常攻撃.wav")
SE_enemy_damage   = Sound.new("sound/敵被弾.wav")
SE_enemy_knockout = Sound.new("sound/雑魚ふっとび.wav")
SE_damage         = Sound.new("sound/さる被弾.wav")
SE_deth           = Sound.new("sound/さるやられた.wav")
SE_LifeUp         = Sound.new("sound/ライフ回復.wav")
BGM               = Sound.new("sound/tam-n05.mid")
BOSSBGM           = Sound.new("sound/tamau02.mid")
SE_shot.setVolume(220)
SE_enemy_knockout.setVolume(220)

# さる画像読み込み
IMAGE_saruhead = load_stgimage("image/stg_さるあたま.png")
IMAGE_sarubody = load_stgimage("image/stg_さるボディ.png", nil, nil, 8, 8, 20, 13)
IMAGE_saru01   = load_stgimage("image/stg_さる全身02.png")

# さるたま
IMAGE_sarutama  = load_stgimage("image/stg_たまオレンジ花.png", 18, 20)
IMAGE_sarutama2  = load_stgimage("image/stg_たまオレンジ花.png", 18, 20, 5, 5, 14, 14)
# 爆弾
IMAGE_bomb  = [load_stgimage("image/stg_ボム03.png"),
               load_stgimage("image/stg_ボム04.png")]
# 爆発
IMAGE_bomber = [load_stgimage("image/stg_爆発01.png"),
                load_stgimage("image/stg_爆発02.png")]

# 命中後の弾
IMAGE_sarutamadel = Image.load("image/stg_たま赤花.png", 0, 0, 18, 20)
# うきっ
IMAGE_uki = Image.load("image/stg_uki_01.png")

# てきたま画像読み込み
IMAGE_tekitama1  = load_stgimage("image/stg_たま青.png", nil, nil, 1, 1, 10, 10)
IMAGE_tekitama2  = load_stgimage("image/stg_たま黄色.png", 10, 10)
IMAGE_tekitama3  = load_stgimage("image/stg_たま魔女.png")
IMAGE_tekitama3p = load_stgimage("image/stg_たまきらきら03.png")
IMAGE_usatama    = load_stgimage("image/stg_たま星.png")
IMAGE_usatama2   = load_stgimage("image/stg_たま星02.png")


# てき画像読み込み
IMAGE_obake    = [load_stgimage("image/stg_おばけ01.png"),
                  load_stgimage("image/stg_おばけ02.png")]
IMAGE_obakehit = load_stgimage("image/stg_おばけ被弾.png")
IMAGE_jack1     = load_stgimage("image/stg_ジャック01.png"     , 50 , 39)
IMAGE_jack2     = load_stgimage("image/stg_ジャック被弾.png"     , 50 , 39)
IMAGE_boss     = load_stgimage("image/stg_obakeboss_01.png", 220, 210, 20, 20, 200, 180)
IMAGE_majo1    = load_stgimage("image/stg_魔女っ子01.png", nil, nil, 20, 10, 75, 110)
IMAGE_majo2    = load_stgimage("image/stg_魔女っ子02.png", nil, nil, 20, 10, 75, 110)
IMAGE_majo3    = load_stgimage("image/stg_魔女っ子被弾02.png")

IMAGE_haka         = load_stgimage("image/stg_墓穴01.png", nil, nil, 35, 16, 85, 112)
IMAGE_hakahit      = load_stgimage("image/stg_墓穴02.png", nil, nil, 35, 16, 85, 112)
IMAGE_hakad        = load_stgimage("image/stg_墓穴03.png", nil, nil, 35, 16, 85, 112)
IMAGE_hakadhit     = load_stgimage("image/stg_墓穴04.png", nil, nil, 35, 16, 85, 112)
IMAGE_hakaDestroy  = load_stgimage("image/stg_墓穴破壊01.png")
IMAGE_bat          = [load_stgimage("image/stg_コウモリ01.png"),
                      load_stgimage("image/stg_コウモリ02.png")]
IMAGE_bathit       = load_stgimage("image/stg_コウモリ反転被弾.png")
IMAGE_batdead      = load_stgimage("image/stg_コウモリ死亡.png")

IMAGE_usagi     = [load_stgimage("image/stg_うさぎ移動01.png"),
                   load_stgimage("image/stg_うさぎ移動02.png")]
IMAGE_usagistop = [load_stgimage("image/stg_うさぎ01.png"),
                   load_stgimage("image/stg_うさぎ02.png")]
IMAGE_usagihit  = load_stgimage("image/stg_うさぎ被弾.png")
IMAGE_usagiatk  = load_stgimage("image/stg_うさぎ攻撃.png")

IMAGE_moku      = load_stgimage("image/stg_もくもく01.png")
IMAGE_moku2     = load_stgimage("image/stg_もくもく02.png")

# アイテム画像読み込み
IMAGE_life      = [load_stgimage("image/stg_ハート01.png"),
                   load_stgimage("image/stg_ハート02.png"),
                   load_stgimage("image/stg_ハート03.png"),
                   load_stgimage("image/stg_ハート04.png")]
IMAGE_note      = [load_stgimage("image/stg_おんぷ01.png"),
                   load_stgimage("image/stg_おんぷ02.png"),
                   load_stgimage("image/stg_おんぷ03.png"),
                   load_stgimage("image/stg_おんぷ04.png")]
IMAGE_LIFEUP    = load_stgimage("image/stg_ロゴ_ライフ01.png")
IMAGE_ADDOPTION = load_stgimage("image/stg_ロゴ_オプション01.png")
IMAGE_onpukira  = [load_stgimage("image/stg_ハートきらきら01.png"),
                   load_stgimage("image/stg_ハートきらきら02.png")]
IMAGE_lifekira  = [load_stgimage("image/stg_ハートきらきら03.png"),
                   load_stgimage("image/stg_ハートきらきら04.png")]


# ゲームオーバー
IMAGE_gameover = Image.load("image/stg_ゲームオーバー.png")

# 背景読み込み
IMAGE_bg1 = Image.load("image/stg_背景01.png", 0, 0, 640,480)
IMAGE_bg2 = Image.new(1,1)
IMAGE_bg2[0,0] = [91, 0, 14, 108]
IMAGE_bg3 = Image.load("image/stg_背景地面01.png")

IMAGE_stage1 = Image.load("image/stg_logo_stage1.png")

IMAGE_number = Image.loadToArray("image/stg_number_01.png", 10, 1)
IMAGE_score  = Image.load("image/stg_logo_score01.png", 0, 0, 64, 32)
