#_/_/_/_/_/_/_/_/_/_/_/_/_/_/
# ころたま Ver.0.96
#
# (c)2013 こらとらる AoiHikawa
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#GC.disable
#game.draw_collision_mode true
game.collision_group_pair 1, 2, true
#グローバル変数の格納場所
LOCAL_DATA_CONSTANT = {}
def local_data
LOCAL_DATA_CONSTANT
end
#データのロード
game.loading do |ld|
ld.add :img_logo, 88
ld.add :img_char, 128
ld.add :img_btn, 95
ld.add :img_str, 126
ld.load_data :save_data, "savefile", :scope => :private
end
#ゲーム開始
game.on_init do
scene_change :scene_logo
end
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#関数
def set_save_data
c = 0
data = []
data[c] = local_data[:start_stage]
c += 1
data[c] = local_data[:nanido]
c += 1
data[c] = local_data[:bgm] == true ? 1 : 0
c += 1
data[c] = local_data[:sound] == true ? 1 : 0
c += 1
data[c] = local_data[:omake]
c += 1
(0...4).each do |i|
(0...5).each do |j|
data[c] = local_data[:ranking][i][j]
c += 1
end
data[c] = local_data[:clearflg][i] == true ? 1 : 0
c += 1
end
game.load_wait do |ld|
ld.save_data "savefile", data, :scope => :private
end
#speak "#{data}"
end
def get_save_data
c = 0
data = game.loaded_data[:save_data]
local_data[:start_stage] = data[c]
c += 1
local_data[:nanido] = data[c]
c += 1
local_data[:bgm] = data[c] == 1 ? true : false
c += 1
local_data[:sound] = data[c] == 1 ? true : false
c += 1
local_data[:omake] = data[c]
c += 1
local_data[:ranking] = []
local_data[:clearflg] = []
(0...4).each do |i|
local_data[:ranking][i] = []
(0...5).each do |j|
local_data[:ranking][i][j] = data[c]
c += 1
end
local_data[:clearflg][i] = data[c] == 1 ? true : false
c += 1
end
end
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#テンプレ ロゴ表示
sprite_template :tmp_logo do |st|
st.texture :img_logo
st.src_size (32 * 8), (32 * 8)
st.dest_size (32 * 8), (32 * 8)
st.position (32 * 8.5), (32 * 3 + 1)
#st.copy_rect 0, 0
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_logo_r
end
(0...10).each do |i|
cm.proc_call do |sp|
sp.set_color 255,255,255,(25.5 * (i + 1))
end
cm.wait_frame 2
end
cm.wait_frame 160
(0...10).each do |i|
cm.proc_call do |sp|
sp.set_color 255,255,255,255 - (25.5 * i)
end
cm.wait_frame 2
end
cm.proc_call do |sp|
sp.change_animation :ani_logo_c
end
(0...10).each do |i|
cm.proc_call do |sp|
sp.set_color 255,255,255,(25.5 * (i + 1))
end
cm.wait_frame 2
end
cm.wait_frame 160
(0...10).each do |i|
cm.proc_call do |sp|
sp.set_color 255,255,255,255 - (25.5 * i)
end
cm.wait_frame 2
end
cm.proc_call do |sp|
sp.change_animation :ani_logo_d
end
end
st.animation :ani_logo_r do |cm|
cm.copy_rect :frame => 1, :src => [0, 0]
cm.wait_animation
end
st.animation :ani_logo_c do |cm|
cm.copy_rect :frame => 1, :src => [1, 0]
cm.wait_animation
end
st.animation :ani_logo_d do |cm|
cm.proc_call do |sp|
sp.delete
end
end
end
#テンプレ 背景表示
sprite_template :tmp_char do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
#テンプレ 主人公表示
sprite_template :tmp_mainchar do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.center_offset 16, 26
#st.center_position 0, 0
#pos_center = [0, 0]
st.motion :default do |cm|
cm.proc_call do |sp|
#pos_center = sp.get_center_position
sp.change_motion :taiki
end
end
st.motion :taiki do |cm|
cm.loop true
cm.proc_call do |sp|
#sp.change_animation :ani_main
#if pos_center == nil then
# pos_center = sp.get_center_position
#end
#sp.set_center_position pos_center
#sp.set_center_position pos_center[0], pos_center[1]
sp.set_scale 1, 1
end
cm.wait_frame 22
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.95
end
cm.wait_frame 2
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.9
end
cm.wait_frame 2
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.85
end
cm.wait_frame 1
cm.proc_call do |sp|
#os_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.8
end
cm.wait_frame 16
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.85
end
cm.wait_frame 2
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.9
end
cm.wait_frame 1
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.95
end
cm.wait_frame 2
#cm.proc_call do |sp|
# wrk_scale = sp.get_scale
# if wrk_scale[1] != 1
# pos_center = sp.get_center_position
# sp.set_center_position pos_center[0], pos_center[1] + 20
# end
#end
end
st.motion :charge do |cm|
cm.proc_call do |sp|
wrk_scale = sp.get_scale
if wrk_scale[1] != 0.8
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.9
end
end
cm.wait_frame 1
cm.proc_call do |sp|
wrk_scale = sp.get_scale
if wrk_scale[1] != 0.8
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] - 20
sp.set_scale 1, 0.8
end
end
end
st.motion :shot do |cm|
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1] + 20
sp.set_scale 1, 1
end
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
#st.animation :ani_main do |cm|
# cm.loop true
# cm.proc_call do |s| s.set_scale 1, 1 end
# cm.wait_frame 16
# cm.wait_animation
# cm.proc_call do |s| s.set_scale 1, 0.7 end
# cm.wait_frame 16
# cm.wait_animation
#end
st.event :on_collision do |event|
source = event.pair[0]
another = event.pair[1]
next unless another
next unless source
if (local_data[:game_mode] == 3) && (local_data[:wait_count] > 0)
type = another.get_data :type
hit_flg_a = false
hit_flg_b = false
hit_flg_c = false
hit_flg_d = false
han_flg = false
han_flg2 = false
s_pos = source.get_position #source.get_center_position + source.get_position
a_pos = another.get_position #another.get_center_position + another.get_position
if s_pos[0] > (a_pos[0] - 32 + 8) && s_pos[0] < (a_pos[0] + 32 - 8) && s_pos[1] > (a_pos[1] - 32 + 8) && s_pos[1] < (a_pos[1] + 32 - 8)
hit_flg_a = true
end
if hit_flg_a
case type
when 1
#敵
han_flg = true
another.change_animation :ani_bomb
another.set_data :type, 0
#another.scene.sprite :template => :tmp_bomb, :center_position => another.get_center_position, :position => [a_pos[0], a_pos[1]] #position => [a_pos[0], a_pos[1]]
#another.delete
#another.set_position -32, -32
local_data[:enemy_count] += 1
when 2
#ブロック
han_flg = true
if local_data[:char_spd] > 9
another.change_animation :ani_bomb
another.set_data :type, 0
#another.scene.sprite :template => :tmp_bomb, :center_position => another.get_center_position, :position => [a_pos[0], a_pos[1]] #, position => [a_pos[0], a_pos[1]]
#another.delete
#another.set_position -32, -32
end
when 4
#ゴール
if local_data[:door_flg]
#if local_data[:char_spd] < 2 && local_data[:char_spd] > 0
# source.set_position a_pos[0], a_pos[1]
# local_data[:char_muki] = 0
# source.copy_rect 0, 0
# source.change_motion :taiki
# #source.change_animation :ani_bomb
# local_data[:char_spd] = 0
# local_data[:wait_count] = 0
# local_data[:game_mode] = 5
#elsif local_data[:char_spd] < 5
# local_data[:down_spd_flg] = true
#end
else
han_flg = true
end
end
end
if s_pos[0] > (a_pos[0] - 32 + 16) && s_pos[0] < (a_pos[0] + 32 - 16) && s_pos[1] > (a_pos[1] - 32 + 16) && s_pos[1] < (a_pos[1] + 32 - 16)
hit_flg_b = true
end
if hit_flg_b
case type
when 3
#穴
if local_data[:boss_wait2] == 0
if local_data[:char_spd] < 2 && local_data[:char_spd] > 0
source.set_position a_pos[0], a_pos[1]
source.change_animation :ani_bomb
local_data[:char_spd] = 0
local_data[:wait_count] = 0
local_data[:game_mode] = 6
elsif local_data[:char_spd] < 5
local_data[:down_spd_flg] = true
end
end
end
end
if s_pos[0] > (a_pos[0] - 32 + 12) && s_pos[0] < (a_pos[0] + 32 - 12) && s_pos[1] > (a_pos[1] - 32 + 12) && s_pos[1] < (a_pos[1] + 32 - 12)
hit_flg_c = true
end
if hit_flg_c
case type
when 4
#ゴール
if local_data[:door_flg]
if local_data[:char_spd] < 2 && local_data[:char_spd] > 0
source.set_position a_pos[0], a_pos[1]
local_data[:char_muki] = 0
source.copy_rect 0, local_data[:omake] * 8 #0
source.change_motion :taiki
#source.change_animation :ani_bomb
local_data[:char_spd] = 0
local_data[:wait_count] = 0
local_data[:game_mode] = 5
elsif local_data[:char_spd] < 5
local_data[:down_spd_flg] = true
end
else
#han_flg = true
end
end
end
if s_pos[0] > (a_pos[0] - 32 + 12) && s_pos[0] < (a_pos[0] + 64 - 12) && s_pos[1] > (a_pos[1] - 32 + 12) && s_pos[1] < (a_pos[1] + 64 - 12)
hit_flg_d = true
end
if hit_flg_d
case type
when 5
#ボス
motion = another.get_data :motion
if motion != 10
han_flg2 = true
if (local_data[:char_spd] > 3) && (local_data[:ren_hit] < 1)
local_data[:ren_hit] = 64
local_data[:boss_dmg] += 1
end
end
end
end
if han_flg
if s_pos[0] < (a_pos[0] - 10)
if s_pos[1] < (a_pos[1] - 10)
#左上
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 3
#s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] - 32 + 4)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 4)
#s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] - 32 + 4)
end
elsif s_pos[1] < (a_pos[1] + 12)
#左中
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 3
#s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] - 32 + 4)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 1
#s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 4)
#s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 4)
#s_pos[1] = (a_pos[1] - 32 + 4)
end
else
#左下
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] - 32 + 4)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 1
#s_pos[0] = (a_pos[0] + (32 - 4))
s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 4)
#s_pos[1] = (a_pos[1] - 32 + 4)
end
end
elsif s_pos[0] < (a_pos[0] + 12)
if s_pos[1] < (a_pos[1] - 10)
#中上
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 3
#s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] - 32 + 4)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 32 - 4)
#s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 4)
#s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 5
#s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] - 32 + 4)
end
elsif s_pos[1] < (a_pos[1] + 12)
#中中
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] - 32 + 4)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] - 32 + 4)
end
else
#中下
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 32 - 4)
#s_pos[1] = (a_pos[1] - (32 + 4))
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 1
#s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 7
#s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 4)
#s_pos[1] = (a_pos[1] - 32 + 4)
end
end
else
if s_pos[1] < (a_pos[1] - 10)
#右上
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] - 32 + 4)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 32 - 4)
#s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 5
#s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] - 32 + 4)
end
elsif s_pos[1] < (a_pos[1] + 12)
#右中
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 32 - 4)
#s_pos[1] = (a_pos[1] - 32 + 4)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 32 - 4)
#s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 7
#s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 5
#s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] - 32 + 4)
end
else
#右下
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 4)
when 1
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 32 - 4)
#s_pos[1] = (a_pos[1] - 32 + 4)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 32 - 4)
when 3
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 32 - 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 32 - 4)
when 5
local_data[:char_muki] = 7
#s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] + 32 - 4)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 4)
when 7
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 4)
s_pos[1] = (a_pos[1] - 32 + 4)
end
end
end
local_data[:char_pos][0] = s_pos[0]
local_data[:char_pos][1] = s_pos[1]
#source.set_position s_pos[0], s_pos[1]
end
if han_flg2
if s_pos[0] < (a_pos[0] - 10)
if s_pos[1] < (a_pos[1] - 10)
#左上
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 3
#s_pos[0] = (a_pos[0] + 32 - 8)
s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 8)
#s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] - 32 + 8)
end
elsif s_pos[1] < (a_pos[1] + 54)
#左中
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 3
#s_pos[0] = (a_pos[0] + 32 - 8)
s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 1
#s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 8)
#s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 8)
#s_pos[1] = (a_pos[1] - 32 + 8)
end
else
#左下
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 1
#s_pos[0] = (a_pos[0] + (64 - 8))
s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 8)
#s_pos[1] = (a_pos[1] - 32 + 8)
end
end
elsif s_pos[0] < (a_pos[0] + 54)
if s_pos[1] < (a_pos[1] - 10)
#中上
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 3
#s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 64 - 8)
#s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 8)
#s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 5
#s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] - 32 + 8)
end
elsif s_pos[1] < (a_pos[1] + 54)
#中中
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] - 32 + 8)
end
else
#中下
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 64 - 8)
#s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 1
#s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 7
#s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 8)
#s_pos[1] = (a_pos[1] - 32 + 8)
end
end
else
if s_pos[1] < (a_pos[1] - 10)
#右上
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 64 - 8)
#s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 1
s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 5
#s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] - 32 + 8)
end
elsif s_pos[1] < (a_pos[1] + 54)
#右中
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 64 - 8)
#s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 5
s_pos[0] = (a_pos[0] + 64 - 8)
#s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 7
#s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 5
#s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] - 32 + 8)
end
else
#右下
case local_data[:char_muki]
when 0
local_data[:char_muki] = 4
s_pos[1] = (a_pos[1] - 32 + 8)
when 1
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 64 - 8)
#s_pos[1] = (a_pos[1] - 32 + 8)
when 2
local_data[:char_muki] = 6
s_pos[0] = (a_pos[0] + 64 - 8)
when 3
local_data[:char_muki] = 7
s_pos[0] = (a_pos[0] + 64 - 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 4
local_data[:char_muki] = 0
s_pos[1] = (a_pos[1] + 64 - 8)
when 5
local_data[:char_muki] = 7
#s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] + 64 - 8)
when 6
local_data[:char_muki] = 2
s_pos[0] = (a_pos[0] - 32 + 8)
when 7
local_data[:char_muki] = 3
s_pos[0] = (a_pos[0] - 32 + 8)
s_pos[1] = (a_pos[1] - 32 + 8)
end
end
end
local_data[:char_pos][0] = s_pos[0]
local_data[:char_pos][1] = s_pos[1]
#source.set_position s_pos[0], s_pos[1]
end
end
end
end
#テンプレ キャラ表示(ミニアイコン)
sprite_template :tmp_minichar do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.center_offset 16, 16
st.motion :default do |cm|
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0] - 20, pos_center[1] - 20
sp.set_scale 0.8, 0.8
end
end
end
#テンプレ ボス表示
sprite_template :tmp_boss do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 64, 64
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_boss
end
end
st.animation :ani_boss do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 2]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 2]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 2]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 2]
cm.wait_animation
end
end
#テンプレ 爆発表示
sprite_template :tmp_bomb do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
#sp.change_animation :ani_bomb
end
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
#テンプレ 敵キャラ表示
sprite_template :tmp_enemy_1_A do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 3]
cm.wait_animation
cm.copy_rect :frame => 48, :src => [6, 3]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_1_B do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 3]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 3]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_1_C do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 3]
cm.wait_animation
cm.copy_rect :frame => 24, :src => [6, 3]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_1_D do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 3]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 3]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 3]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_2_A do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 4]
cm.wait_animation
cm.copy_rect :frame => 48, :src => [6, 4]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_2_B do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 4]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 4]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_2_C do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 4]
cm.wait_animation
cm.copy_rect :frame => 24, :src => [6, 4]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_2_D do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 4]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 4]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 4]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_3_A do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 5]
cm.wait_animation
cm.copy_rect :frame => 48, :src => [6, 5]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_3_B do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 5]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 5]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_3_C do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 5]
cm.wait_animation
cm.copy_rect :frame => 24, :src => [6, 5]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_3_D do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 5]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 5]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 5]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_4_A do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 6]
cm.wait_animation
cm.copy_rect :frame => 48, :src => [6, 6]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_4_B do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 6]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 6]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_4_C do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 6]
cm.wait_animation
cm.copy_rect :frame => 24, :src => [6, 6]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_4_D do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 6]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 6]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 6]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_5_A do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 7]
cm.wait_animation
cm.copy_rect :frame => 48, :src => [6, 7]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_5_B do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 16, :src => [6, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 7]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 7]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_5_C do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 7]
cm.wait_animation
cm.copy_rect :frame => 24, :src => [6, 7]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
sprite_template :tmp_enemy_5_D do |st|
st.texture :img_char
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.proc_call do |sp|
sp.change_animation :ani_enemy
end
end
st.animation :ani_enemy do |cm|
cm.loop true
cm.copy_rect :frame => 32, :src => [6, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [7, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [8, 7]
cm.wait_animation
cm.copy_rect :frame => 16, :src => [9, 7]
cm.wait_animation
cm.copy_rect :frame => 32, :src => [6, 7]
cm.wait_animation
end
st.animation :ani_bomb do |cm|
cm.copy_rect :frame => 2, :src => [0, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [1, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [2, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [3, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [4, 1]
cm.wait_animation
cm.copy_rect :frame => 2, :src => [5, 1]
cm.wait_animation
cm.proc_call do |sp|
sp.set_position -32, -32
#sp.delete
end
end
end
#テンプレ ボタン表示
sprite_template :tmp_btn do |st|
st.texture :img_btn
st.src_size 160, 160
st.dest_size 160, 160
st.center_offset 80, 80
st.motion :default do |cm|
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position 80,80#pos_center[0], pos_center[1]
sp.set_scale 1, 1
end
end
st.motion :up do |cm|
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1]
sp.set_scale 0.95, 0.95
end
cm.wait_frame 1
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1]
sp.set_scale 1, 1
end
end
st.motion :down do |cm|
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1]
sp.set_scale 0.95, 0.95
end
cm.wait_frame 1
cm.proc_call do |sp|
#pos_center = sp.get_center_position
#sp.set_center_position pos_center[0], pos_center[1]
sp.set_scale 0.9, 0.9
end
end
end
#テンプレ 文字表示
sprite_template :tmp_str_32 do |st|
st.texture :img_str
st.src_size 32, 32
st.dest_size 32, 32
end
sprite_template :tmp_str_16 do |st|
st.texture :img_str
st.src_size 16, 32
st.dest_size 16, 32
end
sprite_template :tmp_str_10 do |st|
st.texture :img_str
st.src_size 10, 32
st.dest_size 10, 32
end
sprite_template :tmp_str_mode do |st|
st.texture :img_str
st.src_size (32 * 6), 16
st.dest_size (32 * 6), 16
end
sprite_template :tmp_str_title do |st|
st.texture :img_str
st.src_size 32, 32
st.dest_size 32, 32
st.motion :default do |cm|
cm.loop true
(0...5).each do |i|
cm.proc_call do |sp|
sp.set_color 250 - (25.5 * (i + 1)),250,255,255
end
cm.wait_frame 6
end
(0...5).each do |i|
cm.proc_call do |sp|
sp.set_color 250 - (25.5 * (5 + 1)) + (25.5 * (i + 1)),250 - (25.5 * (i + 1)),255,255
end
cm.wait_frame 6
end
(0...5).each do |i|
cm.proc_call do |sp|
sp.set_color 250,250 - (25.5 * (5 + 1)) + (25.5 * (i + 1)),255 - (25.5 * (i + 1)),255
end
cm.wait_frame 6
end
(0...5).each do |i|
cm.proc_call do |sp|
sp.set_color 250,250,255 - (25.5 * (5 + 1)) + (25.5 * (i + 1)),255
end
cm.wait_frame 6
end
#cm.proc_call do |sp|
# sp.set_color 255,0,255,255
#end
#cm.wait_frame 2
#cm.proc_call do |sp|
# sp.set_color 0,255,255,255
#end
#cm.wait_frame 2
end
end
sprite_template :tmp_str_stage do |st|
st.texture :img_str
st.src_size 48, 32
st.dest_size 48, 32
st.motion :default do |cm|
(0...10).each do |i|
cm.proc_call do |sp|
sp.set_color 255,255,255,(25.5 * (i + 1))
end
cm.wait_frame 2
end
cm.wait_frame 110
(0...10).each do |i|
cm.proc_call do |sp|
sp.set_color 255,255,255,255 - (25.5 * i)
end
cm.wait_frame 2
end
cm.proc_call do |sp|
sp.change_animation :ani_stage_d
end
end
st.animation :ani_stage_d do |cm|
cm.proc_call do |sp|
sp.delete
end
end
end
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#シーン ロゴ表示
scene :scene_logo do |scene|
local_data[:wait_count] = 0
local_data[:start_life] = 5
if game.loaded_data_result[:save_data][:success]
get_save_data
else
local_data[:start_stage] = 0
local_data[:nanido] = 1
local_data[:bgm] = false
local_data[:sound] = false
local_data[:omake] = 0
local_data[:ranking] = []
(0...4).each do |i|
local_data[:ranking][i] = [99,99,99,99,99]
end
local_data[:clearflg] = [false,false,false,false]
set_save_data
end
view_sp = scene.text :position => [10, 10], :z_order => 99
view_sp.set_text_area_size 200, 40
view_sp.set_font_point_size 18
scene.on_init do
s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [-32, -32], :z_order => 0
s_dummy.copy_rect 0, 0
#使用データのロード
scene.add :image, :template => :tmp_logo #, :color => [255, 255, 255, 0]
scene.event :game_count, :on_step do
if local_data[:wait_count] > 410
#scene.delete :tmp_logo
#タイトルへ
scene_change :scene_title
else
#ダミーで領域を確保する
#s_dummy2 = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [-32, -32], :z_order => 0
#s_dummy2.copy_rect 0, 0
#s_dummy2.delete
local_data[:wait_count] += 1
end
#view_sp.set_text "#{game.loaded_data[:save_data]}" #"#{game.loaded_data_result[:save_data][:success]}" #"待機時間 #{wait_count}"
end
end
end
#シーン タイトル
scene :scene_title do |scene|
local_data[:wait_count] = 0
view_sp = scene.text :position => [10, 10], :z_order => 99
view_sp.set_text_area_size 200, 40
view_sp.set_font_point_size 18
exs_count = 0
char_count = 0
btn_count = 0
scene.on_init do
s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [-32, -32], :z_order => 0
s_dummy.copy_rect 0, 0
#使用データのロード
local_data[:stage] = 0
select_mode = 0
#メインウインドウ
(0...140).each do |i|
pos_x = (i % 10)
if pos_x > 4
pos_x += 15
end
pos_x *= 32
pos_y = ((i / 10).to_i) * 32 + 1
s = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
if (i % 10) == 4 then
s.copy_rect 1, 2
elsif (i % 10) == 5 then
s.copy_rect 2, 2
else
s.copy_rect 0, 2
end
end
#背景
(0...210).each do |i|
pos_x = ((i % 15) + 5) * 32
pos_y = ((i / 15).to_i) * 32 + 1
pos_r = rand(5)
if pos_r > 3
pos_r = 0
end
s = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
s.copy_rect pos_r, (3 + local_data[:stage])
end
#タイトル
(0...36).each do |i|
pos_x = ((i % 6) + 8) * 32
pos_y = ((i / 6).to_i) * 32 + 1 + 16
s = scene.add :image, :template => :tmp_str_title, :position => [pos_x, pos_y], :z_order => 3
s.copy_rect (i % 6), (i / 6).to_i + 3
end
(0...6).each do |i|
pos_x = ((i % 3) + 13) * 32 + 16
pos_y = ((i / 3).to_i + 4) * 32 + 1
if i < 1
s = scene.add :image, :name => :exs_up, :template => :tmp_str_title, :position => [pos_x, pos_y], :z_order => 3
else
s = scene.add :image, :template => :tmp_str_title, :position => [pos_x, pos_y], :z_order => 3
end
s.copy_rect (i % 3) + 11, (i / 3).to_i + 11
end
scene.event :exs_up, :on_touch_up do
exs_count += 1
end
#メニュー
(0...36).each do |i|
pos_x = ((i % 6) + 10) * 32 - 16
pos_y = ((i / 6).to_i + 7) * 32 - 7
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 3
s.copy_rect (i % 6) + 6, (i / 6).to_i + 5
end
#カーソル(主人公)
pos_cur_x = 8 * 32
pos_cur_y = 7 * 32 + 1
s_cur = scene.add :image, :name => :exs_char, :template => :tmp_mainchar, :position => [pos_cur_x, pos_cur_y], :z_order => 3
s_cur.copy_rect 0, local_data[:omake] * 8 #s_cur.copy_rect 0, 0
pos_cur_s = s_cur.get_position
scene.event :exs_char, :on_touch_up do
char_count += 1
if btn_count == 8
btn_count += 1
else
btn_count = 0
end
end
#ボタン ↑
s_btn_up = scene.add :image, :name => :nm_btn_up, :template => :tmp_btn, :position => [0, (4 * 32) + 1], :z_order => 5
s_btn_up.copy_rect 1, 0
s_btn_up.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_up, :on_touch_up do
if select_mode > 0
select_mode -= 1
#wrk_scale = s_cur.get_scale
#if wrk_scale[1] != 1
# #pos_center = s_cur.get_center_position
# #s_cur.set_center_position pos_center[0], pos_center[1] + 20
# s_cur.set_scale 1, 1
#end
pos_cur_s[1] -= 48
s_cur.set_position pos_cur_s[0], pos_cur_s[1]
end
if btn_count == 0
btn_count += 1
elsif btn_count == 1
btn_count += 1
elsif btn_count == 4
btn_count += 1
elsif btn_count == 6
btn_count += 1
else
btn_count = 0
end
s_btn_up.change_motion :up
#view_sp.set_text "メニュー #{select_mode}"
end
scene.event :nm_btn_up, :on_touch_down do
s_btn_up.change_motion :down
end
#ボタン ↓
s_btn_down = scene.add :image, :name => :nm_btn_down, :template => :tmp_btn, :position => [0, (9 * 32) + 1], :z_order => 5
s_btn_down.copy_rect 1, 1
s_btn_down.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_down, :on_touch_up do
if select_mode < 3
select_mode += 1
#wrk_scale = s_cur.get_scale
#if wrk_scale[1] != 1
# #pos_center = s_cur.get_center_position
# #s_cur.set_center_position pos_center[0], pos_center[1] + 20
# s_cur.set_scale 1, 1
#end
pos_cur_s[1] += 48
s_cur.set_position pos_cur_s[0], pos_cur_s[1]
end
if btn_count == 2
btn_count += 1
elsif btn_count == 3
btn_count += 1
elsif btn_count == 5
btn_count += 1
elsif btn_count == 7
btn_count += 1
else
btn_count = 0
end
s_btn_down.change_motion :up
#view_sp.set_text "メニュー #{select_mode}"
end
scene.event :nm_btn_down, :on_touch_down do
s_btn_down.change_motion :down
end
#ボタン ○
s_btn_maru = scene.add :image, :name => :nm_btn_maru, :template => :tmp_btn, :position => [(20 * 32), (9 * 32) + 1], :z_order => 5
s_btn_maru.copy_rect 3, 1
s_btn_maru.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_maru, :on_touch_up do
case select_mode
when 0 then
#ゲームメイン用 データの初期化
local_data[:stage] = local_data[:start_stage]
local_data[:life] = local_data[:start_life]
#ゲームメインへ
scene_change :scene_main
when 1 then
#ランキングへ
scene_change :scene_ranking
#scene_change :scene_staff
when 2 then
#ゲームオプションへ
scene_change :scene_option
when 3 then
#終了へ
scene_change :scene_exit
end
s_btn_maru.change_motion :up
#view_sp.set_text "メニュー #{select_mode}"
end
scene.event :nm_btn_maru, :on_touch_down do
s_btn_maru.change_motion :down
end
scene.event :game_count, :on_step do
if char_count > 0
if !(local_data[:clearflg][0])
local_data[:clearflg][0] = true
set_save_data
end
end
if char_count > 4
if !(local_data[:clearflg][1])
local_data[:clearflg][0] = true
local_data[:clearflg][1] = true
set_save_data
end
end
if exs_count > 4
if !(local_data[:clearflg][2])
local_data[:clearflg][0] = true
local_data[:clearflg][1] = true
local_data[:clearflg][2] = true
set_save_data
end
end
if btn_count > 8
if !(local_data[:clearflg][3])
local_data[:clearflg][0] = true
local_data[:clearflg][1] = true
local_data[:clearflg][2] = true
local_data[:clearflg][3] = true
set_save_data
end
end
end
end
end
#シーン ゲームメイン
scene :scene_main do |scene|
local_data[:wait_count] = 0
view_sp = scene.text :position => [10, 10], :z_order => 99
view_sp.set_text_area_size 240, 240
view_sp.set_font_point_size 18
#変数の定義
game_stage = local_data[:stage]
nanido = local_data[:nanido]
local_data[:game_mode] = 0
local_data[:shot_count] = 0
#local_data[:shot_view_wait] = 0
local_data[:enemy_count] = 0
local_data[:old_enemy_count] = 0
local_data[:door_flg] = false
char_life = local_data[:life]
local_data[:char_muki] = 0
local_data[:char_pos] = [0, 0]
local_data[:char_spd] = 0
local_data[:down_spd_flg] = false
local_data[:char_pos2] = [0, 0]
local_data[:char_pos3] = [0, 0]
local_data[:cursor_pos] = [0, 0]
local_data[:cursor_wait] = 0
local_data[:cursor_act] = 0
local_data[:boss_pos] = [0, 0]
local_data[:old_boss_dmg] = 0
local_data[:boss_dmg] = 0
local_data[:ren_hit] = 0
local_data[:boss_wait2] = 0
map_data = []
#(0...210).each do |i|
# map_data[i] = 0
#end
char_s = 0
enemy_s = []
block_s = []
gage_s = []
shotc_s = []
life_c_s = []
enemy_c_s = []
btn_left_flg = false
btn_right_flg = false
pos_min = [((32 * 5) - 4), (32 - 3)]
pos_max = [((32 * 19) + 4), (416 + 5)]
boss_max = 99
case nanido
when 0
gage_spd = 5
case game_stage
when 0 then
enemy_max = 7
block_max = 7
hole_max = 5
down_spd = 7
when 1 then
enemy_max = 9
block_max = 10
hole_max = 10
down_spd = 5
when 2 then
enemy_max = 12
block_max = 12
hole_max = 12
down_spd = 7
when 3 then
enemy_max = 15
block_max = 14
hole_max = 14
down_spd = 14
when 4 then
enemy_max = 15
block_max = 16
hole_max = 15
down_spd = 7
boss_max = 7
#when 5 then
# enemy_max = 12
# block_max = 0
# hole_max = 30
# down_spd = 7
end
when 1
gage_spd = 3
case game_stage
when 0 then
enemy_max = 10
block_max = 7
hole_max = 7
down_spd = 7
when 1 then
enemy_max = 12
block_max = 10
hole_max = 12
down_spd = 5
when 2 then
enemy_max = 16
block_max = 12
hole_max = 15
down_spd = 7
when 3 then
enemy_max = 20
block_max = 14
hole_max = 17
down_spd = 14
when 4 then
enemy_max = 20
block_max = 17
hole_max = 17
down_spd = 7
boss_max = 10
#when 5 then
# enemy_max = 12
# block_max = 0
# hole_max = 30
# down_spd = 7
end
when 2
gage_spd = 2
case game_stage
when 0 then
enemy_max = 13
block_max = 7
hole_max = 7
down_spd = 7
when 1 then
enemy_max = 15
block_max = 10
hole_max = 12
down_spd = 5
when 2 then
enemy_max = 18
block_max = 12
hole_max = 15
down_spd = 7
when 3 then
enemy_max = 22
block_max = 14
hole_max = 17
down_spd = 14
when 4 then
enemy_max = 24
block_max = 17
hole_max = 17
down_spd = 7
boss_max = 14
#when 5 then
# enemy_max = 12
# block_max = 0
# hole_max = 30
# down_spd = 7
end
when 3
gage_spd = 2
case game_stage
when 0 then
enemy_max = 13
block_max = 7
hole_max = 10
down_spd = 7
when 1 then
enemy_max = 15
block_max = 10
hole_max = 15
down_spd = 5
when 2 then
enemy_max = 18
block_max = 12
hole_max = 18
down_spd = 7
when 3 then
enemy_max = 22
block_max = 14
hole_max = 20
down_spd = 14
when 4 then
enemy_max = 24
block_max = 17
hole_max = 20
down_spd = 7
boss_max = 20
#when 5 then
# enemy_max = 12
# block_max = 0
# hole_max = 30
# down_spd = 7
end
end
scene.on_init do
s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [-32, -32], :z_order => 0
s_dummy.copy_rect 0, 0
#使用データのロード
#メインウインドウ
(0...140).each do |i|
pos_x = (i % 10)
if pos_x > 4
pos_x += 15
end
pos_x *= 32
pos_y = ((i / 10).to_i) * 32 + 1
s = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
if (i % 10) == 4 then
s.copy_rect 1, 2
elsif (i % 10) == 5 then
s.copy_rect 2, 2
else
s.copy_rect 0, 2
end
end
#背景
(0...210).each do |i|
pos_x = ((i % 15) + 5) * 32
pos_y = ((i / 15).to_i) * 32 + 1
pos_r = rand(5)
if pos_r > 3
pos_r = 0
end
s = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
s.copy_rect pos_r, (3 + game_stage)
map_data[i] = 0
end
#主人公
map_data[15 * 13] = 1
pos_x = (-32)
pos_y = (-32)
local_data[:char_pos2][0] = pos_x
local_data[:char_pos2][1] = pos_y
char_s2 = scene.add :image, :name => :player, :template => :tmp_mainchar, :position => [pos_x, pos_y], :z_order => 4
char_s2.change_motion :shot
char_s2.copy_rect 8, local_data[:omake] * 8 #0
char_s2.set_color 255, 255, 255, 200
local_data[:char_pos3][0] = pos_x
local_data[:char_pos3][1] = pos_y
char_s3 = scene.add :image, :name => :player, :template => :tmp_mainchar, :position => [pos_x, pos_y], :z_order => 4
char_s3.change_motion :shot
char_s3.copy_rect 8, local_data[:omake] * 8 #0
char_s3.set_color 255, 255, 255, 145
pos_x = 5 * 32
pos_y = 13 * 32 + 1
local_data[:char_pos][0] = pos_x
local_data[:char_pos][1] = pos_y
char_s = scene.add :image, :name => :player, :template => :tmp_mainchar, :position => [pos_x, pos_y], :z_order => 4
char_s.copy_rect 0, local_data[:omake] * 8 #0
char_s.collision :rect, :mode => :left_top, :position => [0, 0], :width => [32, 32], :group_id => 1
pos_x = (-32)
pos_y = (-32)
local_data[:cursor_pos][0] = pos_x
local_data[:cursor_pos][1] = pos_y
cursor_s = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 9
cursor_s.copy_rect 8, 1
#ゴール
if game_stage != 4
p = rand(180) #rand(195)
p += 15
while map_data[p] != 0 do
p = rand(180) #rand(195)
p += 15
end
map_data[p] = 2
pos_x = ((p % 15) + 5) * 32
pos_y = ((p / 15).to_i) * 32 + 1
goal_s = scene.add :image, :name => :goal, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 3
goal_s.copy_rect 6, 1
goal_s.collision :rect, :mode => :left_top, :position => [0, 0], :width => [32, 32], :group_id => 2
goal_s.set_data :type, 4
else
pos_x = 12 * 32 - 16
pos_y = (-65)
local_data[:boss_pos][0] = pos_x
local_data[:boss_pos][1] = pos_y
boss_s = scene.add :image, :name => :boss, :template => :tmp_boss, :position => [pos_x, pos_y], :z_order => 6
boss_s.copy_rect 6, 2
boss_s.collision :rect, :mode => :left_top, :position => [0, 0], :width => [64, 64], :group_id => 2
boss_s.set_data :type, 5
boss_s.set_data :motion, 0
bomb_s = scene.add :image, :name => :bomb, :template => :tmp_bomb, :position => [(-32), (-32)], :z_order => 7
bomb_s.copy_rect 0, 1
end
#穴
(0...hole_max).each do |i|
p = rand(195)
p += 15
while map_data[p] != 0 do
p = rand(195)
p += 15
end
map_data[p] = 3
pos_x = ((p % 15) + 5) * 32
pos_y = ((p / 15).to_i) * 32 + 1
hole_s = scene.add :image, :name => :hole, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 2
hole_s.copy_rect 4, (3 + game_stage)
hole_s.collision :rect, :mode => :left_top, :position => [0, 0], :width => [32, 32], :group_id => 2
hole_s.set_data :type, 3
end
#ブロック
(0...block_max).each do |i|
p = rand(165) #rand(195)
p += 30 #p += 15
while (map_data[p] != 0) || ((p % 15) == 0) || ((p % 15) == 14) do
p = rand(165) #rand(195)
p += 30 #p += 15
end
map_data[p] = 4
pos_x = ((p % 15) + 5) * 32
pos_y = ((p / 15).to_i) * 32 + 1
block_s[i] = scene.add :image, :name => :block, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 5
block_s[i].copy_rect 5, (3 + game_stage)
block_s[i].collision :rect, :mode => :left_top, :position => [0, 0], :width => [32, 32], :group_id => 2
block_s[i].set_data :type, 2
end
#敵キャラクター
(0...enemy_max).each do |i|
p = rand(195)
p += 15
while !((map_data[p] == 0) || ((map_data[p] == 3) && (game_stage > 1))) do
p = rand(195)
p += 15
end
map_data[p] = 4
pos_x = ((p % 15) + 5) * 32
pos_y = ((p / 15).to_i) * 32 + 1
type = rand(4)
case game_stage
when 0 then
case type
when 0 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_1_A, :position => [pos_x, pos_y], :z_order => 4
when 1 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_1_B, :position => [pos_x, pos_y], :z_order => 4
when 2 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_1_C, :position => [pos_x, pos_y], :z_order => 4
when 3 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_1_D, :position => [pos_x, pos_y], :z_order => 4
end
when 1 then
case type
when 0 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_2_A, :position => [pos_x, pos_y], :z_order => 4
when 1 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_2_B, :position => [pos_x, pos_y], :z_order => 4
when 2 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_2_C, :position => [pos_x, pos_y], :z_order => 4
when 3 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_2_D, :position => [pos_x, pos_y], :z_order => 4
end
when 2 then
case type
when 0 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_3_A, :position => [pos_x, pos_y], :z_order => 4
when 1 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_3_B, :position => [pos_x, pos_y], :z_order => 4
when 2 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_3_C, :position => [pos_x, pos_y], :z_order => 4
when 3 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_3_D, :position => [pos_x, pos_y], :z_order => 4
end
when 3 then
case type
when 0 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_4_A, :position => [pos_x, pos_y], :z_order => 4
when 1 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_4_B, :position => [pos_x, pos_y], :z_order => 4
when 2 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_4_C, :position => [pos_x, pos_y], :z_order => 4
when 3 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_4_D, :position => [pos_x, pos_y], :z_order => 4
end
when 4 then
case type
when 0 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_5_A, :position => [pos_x, pos_y], :z_order => 4
when 1 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_5_B, :position => [pos_x, pos_y], :z_order => 4
when 2 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_5_C, :position => [pos_x, pos_y], :z_order => 4
when 3 then
enemy_s[i] = scene.add :image, :name => :enemy, :template => :tmp_enemy_5_D, :position => [pos_x, pos_y], :z_order => 4
end
end
enemy_s[i].collision :rect, :mode => :left_top, :position => [0, 0], :width => [32, 32], :group_id => 2
enemy_s[i].set_data :type, 1
#if nanido > 1
# enemy_s[i].set_color 255, 0, 255, 255
#end
#s.copy_rect 6, (3 + game_stage)
end
#ボタン ←
s_btn_leftc = scene.add :image, :name => :nm_btn_leftc, :template => :tmp_btn, :position => [0, (4 * 32) + 1], :z_order => 5
s_btn_leftc.copy_rect 2, 0
s_btn_leftc.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_leftc, :on_touch_up do
case local_data[:game_mode]
when 1
if !(btn_left_flg)
local_data[:char_muki] -= 1
if local_data[:char_muki] < 0
local_data[:char_muki] = 7
end
local_data[:cursor_wait] = 0
local_data[:cursor_act] = 0
char_s.copy_rect local_data[:char_muki], local_data[:omake] * 8 #0
end
end
btn_left_flg = false
s_btn_leftc.change_motion :up
end
scene.event :nm_btn_leftc, :on_touch_down do
case local_data[:game_mode]
when 3
btn_left_flg = true
end
s_btn_leftc.change_motion :down
end
#ボタン →
s_btn_rightc = scene.add :image, :name => :nm_btn_rightc, :template => :tmp_btn, :position => [0, (9 * 32) + 1], :z_order => 5
s_btn_rightc.copy_rect 2, 1
s_btn_rightc.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_rightc, :on_touch_up do
case local_data[:game_mode]
when 1
if !(btn_right_flg)
local_data[:char_muki] += 1
if local_data[:char_muki] > 7
local_data[:char_muki] = 0
end
local_data[:cursor_wait] = 0
local_data[:cursor_act] = 0
char_s.copy_rect local_data[:char_muki], local_data[:omake] * 8 #0
end
end
btn_right_flg = false
s_btn_rightc.change_motion :up
end
scene.event :nm_btn_rightc, :on_touch_down do
case local_data[:game_mode]
when 3
btn_right_flg = true
end
s_btn_rightc.change_motion :down
end
#ボタン ○
s_btn_maru = scene.add :image, :name => :nm_btn_maru, :template => :tmp_btn, :position => [(20 * 32), (9 * 32) + 1], :z_order => 5
s_btn_maru.copy_rect 3, 1
s_btn_maru.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_maru, :on_touch_up do
case local_data[:game_mode]
when 2
char_s.change_motion :shot
char_s.copy_rect 8, local_data[:omake] * 8 #0
local_data[:wait_count] = 0
local_data[:game_mode] = 3
end
s_btn_maru.change_motion :up
end
scene.event :nm_btn_maru, :on_touch_down do
case local_data[:game_mode]
when 1
if !(boss_max == local_data[:boss_dmg])
char_s.change_motion :charge
gage_s[0].copy_rect 4, 2
local_data[:cursor_wait] = 0
local_data[:cursor_act] = 0
local_data[:cursor_pos][0] = (-32)
local_data[:cursor_pos][1] = (-32)
cursor_s.set_position local_data[:cursor_pos][0], local_data[:cursor_pos][1]
local_data[:shot_count] += 1
#local_data[:shot_view_wait] = 60
if local_data[:shot_count] > 99
local_data[:shot_count] = 99
end
shotc_s[2].copy_rect ((local_data[:shot_count]) / 10).to_i, 0
shotc_s[3].copy_rect ((local_data[:shot_count]) % 10), 0
#pos_x = local_data[:char_pos][0] - 32 #32 * 11
#pos_y = local_data[:char_pos][1] - 32 #32 * 7
#(0...4).each do |i|
# shotc_s[i].set_position pos_x, pos_y
# pos_x += 16
# if i < 2
# pos_x += 16
# end
#end
local_data[:wait_count] = 0
local_data[:char_spd] = 1
local_data[:game_mode] = 2
end
end
s_btn_maru.change_motion :down
end
#速度ゲージ
(0...10).each do |i|
pos_x = (i + 5) * 32
pos_y = 1
gage_s[i] = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 5
gage_s[i].copy_rect 3, 2
end
#残りライフ
pos_x = 15 * 32 - 6
pos_y = 1
s = scene.add :image, :template => :tmp_minichar, :position => [pos_x + 3, pos_y], :z_order => 5 #:position => [(pos_x - 5), (pos_y - 2)], :z_order => 5
s.copy_rect 0, local_data[:omake] * 8 #0
pos_x += 32
s = scene.add :image, :template => :tmp_str_10, :position => [pos_x, pos_y], :z_order => 5
s.copy_rect 23, 0
pos_x += 10
s = scene.add :image, :template => :tmp_str_10, :position => [pos_x, pos_y], :z_order => 5
s.copy_rect 24, 0
pos_x += 10
life_c_s[0] = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 5
life_c_s[0].copy_rect 0, 0
pos_x += 16
life_c_s[1] = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 5
life_c_s[1].copy_rect local_data[:life], 0
#残り敵数
pos_x = 17 * 32 + 10
zan_s = scene.add :image, :template => :tmp_minichar, :position => [pos_x + 3, pos_y], :z_order => 5 # :position => [(pos_x - 5), (pos_y - 2)], :z_order => 5
zan_s.copy_rect 6, (3 + game_stage)
pos_x += 32
s = scene.add :image, :template => :tmp_str_10, :position => [pos_x, pos_y], :z_order => 5
s.copy_rect 23, 0
pos_x += 10
s = scene.add :image, :template => :tmp_str_10, :position => [pos_x, pos_y], :z_order => 5
s.copy_rect 24, 0
pos_x += 10
enemy_c_s[0] = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 5
enemy_c_s[0].copy_rect ((enemy_max - local_data[:enemy_count]) / 10).to_i, 0
pos_x += 16
enemy_c_s[1] = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 5
enemy_c_s[1].copy_rect ((enemy_max - local_data[:enemy_count]) % 10), 0
#難易度
pos_x = 32 * 21 #(-32)
pos_y = 32 * 1 #(-32)
(0...3).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 9
s.copy_rect 8 + i + (local_data[:nanido] * 3), 0
pos_x += 32
end
#ステージ
pos_x = 32 * 20 + 24 #(-32)
pos_y = 32 * 2 + 16 #(-32)
(0...3).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 9
s.copy_rect 12 + i, 6
pos_x += 32
end
pos_x -= 8
s = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 9
s.copy_rect (game_stage + 1), 0
#ショット数
pos_x = 32 * 21 #(-32)
pos_y = 32 * 4 #(-32)
(0...2).each do |i|
shotc_s[i] = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 9
shotc_s[i].copy_rect (18 + i), 4
pos_x += 32
end
(2...4).each do |i|
shotc_s[i] = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 9
shotc_s[i].copy_rect 0, 0
pos_x += 16
end
#ステージ番号表示
(0...4).each do |i|
pos_x = (i + 5) * 48 + 32
pos_y = 6 * 32
s = scene.add :image, :template => :tmp_str_stage, :position => [pos_x, pos_y], :z_order => 7
s.copy_rect i, 1
pos_y += 32
s = scene.add :image, :template => :tmp_str_stage, :position => [pos_x, pos_y], :z_order => 7
s.copy_rect i, 2
end
pos_x = (5 + 4) * 48 + 32
pos_y = 6 * 32
s = scene.add :image, :template => :tmp_str_stage, :position => [pos_x, pos_y], :z_order => 7
if game_stage < 4
s.copy_rect (5 + game_stage), 1
else
s.copy_rect game_stage, 3
end
pos_y += 32
s = scene.add :image, :template => :tmp_str_stage, :position => [pos_x, pos_y], :z_order => 7
if game_stage < 4
s.copy_rect (5 + game_stage), 2
else
s.copy_rect game_stage, 4
end
#動作管理
scene.event :game_count, :on_step do
case local_data[:game_mode]
when 0
if local_data[:wait_count] > 155
local_data[:wait_count] = 0
local_data[:cursor_wait] = 0
local_data[:cursor_act] = 0
char_s.copy_rect 5, local_data[:omake] * 8 #0
local_data[:char_muki] = 5
local_data[:game_mode] = 1
else
local_data[:wait_count] += 1
end
when 1
if boss_max != local_data[:boss_dmg]
if local_data[:cursor_wait] > 5
pos_x = local_data[:char_pos][0]
pos_y = local_data[:char_pos][1]
local_data[:cursor_act] += 1
if local_data[:cursor_act] > 3
local_data[:cursor_act] = 0
end
case local_data[:char_muki]
when 0
pos_y += ((8 * local_data[:cursor_act]) + 24)
when 1
pos_x -= ((6 * local_data[:cursor_act]) + 18)
pos_y += ((6 * local_data[:cursor_act]) + 18)
when 2
pos_x -= ((8 * local_data[:cursor_act]) + 23)
when 3
pos_x -= ((6 * local_data[:cursor_act]) + 18)
pos_y -= ((6 * local_data[:cursor_act]) + 16)
when 4
pos_y -= ((8 * local_data[:cursor_act]) + 20)
when 5
pos_x += ((6 * local_data[:cursor_act]) + 18)
pos_y -= ((6 * local_data[:cursor_act]) + 16)
when 6
pos_x += ((8 * local_data[:cursor_act]) + 24)
when 7
pos_x += ((6 * local_data[:cursor_act]) + 18)
pos_y += ((6 * local_data[:cursor_act]) + 18)
end
local_data[:cursor_pos][0] = pos_x
local_data[:cursor_pos][1] = pos_y
cursor_s.set_position local_data[:cursor_pos][0], local_data[:cursor_pos][1]
local_data[:cursor_wait] = 0
else
local_data[:cursor_wait] += 1
end
end
when 2
if local_data[:wait_count] > gage_spd
local_data[:wait_count] = 0
local_data[:char_spd] += 1
if local_data[:char_spd] > 10
local_data[:char_spd] = 1
gage_s[0].copy_rect 4, 2
(1...10).each do |i|
gage_s[i].copy_rect 3, 2
end
elsif local_data[:char_spd] > 9
(0...10).each do |i|
gage_s[i].copy_rect 5, 2
end
else
gage_s[(local_data[:char_spd] - 1)].copy_rect 4, 2
end
else
local_data[:wait_count] += 1
end
when 3
if local_data[:wait_count] > 0
local_data[:char_pos3][0] = local_data[:char_pos2][0]
local_data[:char_pos3][1] = local_data[:char_pos2][1]
char_s3.set_position local_data[:char_pos3][0], local_data[:char_pos3][1]
local_data[:char_pos2][0] = local_data[:char_pos][0]
local_data[:char_pos2][1] = local_data[:char_pos][1]
char_s2.set_position local_data[:char_pos2][0], local_data[:char_pos2][1]
if local_data[:char_spd] > 6
add_spd = 3
elsif local_data[:char_spd] > 3
add_spd = 2
else
add_spd = 1
end
spd_a = (local_data[:char_spd] * add_spd + 1)
spd_b = (spd_a * (2 / 3)).to_i
case local_data[:char_muki]
when 0
#local_data[:char_pos][0] += 0
local_data[:char_pos][1] += spd_a
if local_data[:char_pos][1] > pos_max[1]
local_data[:char_pos][1] = pos_max[1]
local_data[:char_muki] = 4
end
if btn_left_flg
local_data[:char_pos][0] += 2
if local_data[:char_pos][0] > pos_max[0]
local_data[:char_pos][0] = pos_max[0]
end
end
if btn_right_flg
local_data[:char_pos][0] -= 2
if local_data[:char_pos][0] < pos_min[0]
local_data[:char_pos][0] = pos_min[0]
end
end
when 1
local_data[:char_pos][0] -= spd_b
local_data[:char_pos][1] += spd_b
if local_data[:char_pos][1] > pos_max[1]
local_data[:char_pos][1] = pos_max[1]
local_data[:char_muki] = 3
elsif local_data[:char_pos][0] < pos_min[0]
local_data[:char_pos][0] = pos_min[0]
local_data[:char_muki] = 7
end
if btn_left_flg
local_data[:char_pos][0] -= 2
if local_data[:char_pos][0] < pos_min[0]
local_data[:char_pos][0] = pos_min[0]
end
end
if btn_right_flg
local_data[:char_pos][1] += 2
if local_data[:char_pos][1] > pos_max[1]
local_data[:char_pos][1] = pos_max[1]
end
end
when 2
local_data[:char_pos][0] -= spd_a
#local_data[:char_pos][1] += 0
local_data[:char_pos][0] -= spd_a
if local_data[:char_pos][0] < pos_min[0]
local_data[:char_pos][0] = pos_min[0]
local_data[:char_muki] = 6
end
if btn_left_flg
local_data[:char_pos][1] += 2
if local_data[:char_pos][1] > pos_max[1]
local_data[:char_pos][1] = pos_max[1]
end
end
if btn_right_flg
local_data[:char_pos][1] -= 2
if local_data[:char_pos][1] < pos_min[1]
local_data[:char_pos][1] = pos_min[1]
end
end
when 3
local_data[:char_pos][0] -= spd_b
local_data[:char_pos][1] -= spd_b
if local_data[:char_pos][1] < pos_min[1]
local_data[:char_pos][1] = pos_min[1]
local_data[:char_muki] = 1
elsif local_data[:char_pos][0] < pos_min[0]
local_data[:char_pos][0] = pos_min[0]
local_data[:char_muki] = 5
end
if btn_left_flg
local_data[:char_pos][0] -= 2
if local_data[:char_pos][0] < pos_min[0]
local_data[:char_pos][0] = pos_min[0]
end
end
if btn_right_flg
local_data[:char_pos][1] -= 2
if local_data[:char_pos][1] < pos_min[1]
local_data[:char_pos][1] = pos_min[1]
end
end
when 4
#local_data[:char_pos][0] += 0
local_data[:char_pos][1] -= spd_a
if local_data[:char_pos][1] < pos_min[1]
local_data[:char_pos][1] = pos_min[1]
local_data[:char_muki] = 0
end
if btn_left_flg
local_data[:char_pos][0] -= 2
if local_data[:char_pos][0] < pos_min[0]
local_data[:char_pos][0] = pos_min[0]
end
end
if btn_right_flg
local_data[:char_pos][0] += 2
if local_data[:char_pos][0] > pos_max[0]
local_data[:char_pos][0] = pos_max[0]
end
end
when 5
local_data[:char_pos][0] += spd_b
local_data[:char_pos][1] -= spd_b
if local_data[:char_pos][1] < pos_min[1]
local_data[:char_pos][1] = pos_min[1]
local_data[:char_muki] = 7
elsif local_data[:char_pos][0] > pos_max[0]
local_data[:char_pos][0] = pos_max[0]
local_data[:char_muki] = 3
end
if btn_left_flg
local_data[:char_pos][1] -= 2
if local_data[:char_pos][1] < pos_min[1]
local_data[:char_pos][1] = pos_min[1]
end
end
if btn_right_flg
local_data[:char_pos][0] += 2
if local_data[:char_pos][0] > pos_max[0]
local_data[:char_pos][0] = pos_max[0]
end
end
when 6
local_data[:char_pos][0] += spd_a
#local_data[:char_pos][1] += 0
if local_data[:char_pos][0] > pos_max[0]
local_data[:char_pos][0] = pos_max[0]
local_data[:char_muki] = 2
end
if btn_left_flg
local_data[:char_pos][1] -= 2
if local_data[:char_pos][1] < pos_min[1]
local_data[:char_pos][1] = pos_min[1]
end
end
if btn_right_flg
local_data[:char_pos][1] += 2
if local_data[:char_pos][1] > pos_max[1]
local_data[:char_pos][1] = pos_max[1]
end
end
when 7
local_data[:char_pos][0] += spd_b
local_data[:char_pos][1] += spd_b
if local_data[:char_pos][1] > pos_max[1]
local_data[:char_pos][1] = pos_max[1]
local_data[:char_muki] = 5
elsif local_data[:char_pos][0] > pos_max[0]
local_data[:char_pos][0] = pos_max[0]
local_data[:char_muki] = 1
end
if btn_left_flg
local_data[:char_pos][0] += 2
if local_data[:char_pos][0] > pos_max[0]
local_data[:char_pos][0] = pos_max[0]
end
end
if btn_right_flg
local_data[:char_pos][1] += 2
if local_data[:char_pos][1] > pos_max[1]
local_data[:char_pos][1] = pos_max[1]
end
end
end
char_s.set_position local_data[:char_pos][0], local_data[:char_pos][1]
down_spd_c = down_spd
if local_data[:down_spd_flg]
down_spd_c -= 4
local_data[:down_spd_flg] = false
end
if local_data[:wait_count] > down_spd_c
local_data[:char_spd] -= 1
if local_data[:char_spd] == 9
(0...9).each do |i|
gage_s[i].copy_rect 4, 2
end
gage_s[9].copy_rect 3, 2
else
gage_s[local_data[:char_spd]].copy_rect 3, 2
end
local_data[:wait_count] = 0
else
local_data[:wait_count] += 1
end
if local_data[:char_spd] == 0
char_s.change_motion :taiki
char_s.copy_rect local_data[:char_muki], local_data[:omake] * 8 #0
local_data[:char_pos3][0] = (-32)
local_data[:char_pos3][1] = (-32)
char_s3.set_position local_data[:char_pos3][0], local_data[:char_pos3][1]
local_data[:char_pos2][0] = (-32)
local_data[:char_pos2][1] = (-32)
char_s2.set_position local_data[:char_pos2][0], local_data[:char_pos2][1]
local_data[:cursor_wait] = 0
local_data[:cursor_act] = 0
local_data[:game_mode] = 1
else
if local_data[:old_enemy_count] != local_data[:enemy_count]
enemy_c_s[0].copy_rect ((enemy_max - local_data[:enemy_count]) / 10).to_i, 0
enemy_c_s[1].copy_rect ((enemy_max - local_data[:enemy_count]) % 10), 0
local_data[:old_enemy_count] = local_data[:enemy_count]
if enemy_max == local_data[:enemy_count]
if game_stage != 4
#扉開放
local_data[:door_flg] = true
goal_s.copy_rect 7, 1
else
#ボス登場
zan_s.copy_rect 6, 2
enemy_c_s[0].copy_rect ((boss_max - local_data[:boss_dmg]) / 10).to_i, 0
enemy_c_s[1].copy_rect ((boss_max - local_data[:boss_dmg]) % 10), 0
boss_s.set_data :motion, 1
local_data[:boss_wait] = 0
end
end
end
if local_data[:old_boss_dmg] != local_data[:boss_dmg]
enemy_c_s[0].copy_rect ((boss_max - local_data[:boss_dmg]) / 10).to_i, 0
enemy_c_s[1].copy_rect ((boss_max - local_data[:boss_dmg]) % 10), 0
local_data[:old_boss_dmg] = local_data[:boss_dmg]
if boss_max == local_data[:boss_dmg]
#ボス撃破
local_data[:boss_wait] = 0
boss_s.set_data :motion, 10
local_data[:boss_wait2] = 1
local_data[:boss_pos][0] += 2
#local_data[:game_mode] = 5
end
end
end
else
local_data[:wait_count] += 1
end
when 5
if local_data[:wait_count] == 0
local_data[:char_pos3][0] = (-32)
local_data[:char_pos3][1] = (-32)
char_s3.set_position local_data[:char_pos3][0], local_data[:char_pos3][1]
local_data[:char_pos2][0] = (-32)
local_data[:char_pos2][1] = (-32)
char_s2.set_position local_data[:char_pos2][0], local_data[:char_pos2][1]
(0...10).each do |i|
gage_s[i].copy_rect 3, 2
end
end
if local_data[:wait_count] > 95
if local_data[:wait_count] == 96
#ステージクリア
(0...4).each do |i|
pos_x = (i + 6) * 48 + 8
pos_y = 6 * 32
s = scene.add :image, :template => :tmp_str_stage, :position => [pos_x, pos_y], :z_order => 7
s.copy_rect i, 9
pos_y += 32
s = scene.add :image, :template => :tmp_str_stage, :position => [pos_x, pos_y], :z_order => 7
s.copy_rect i, 10
end
end
if local_data[:wait_count] > 275
if local_data[:ranking][local_data[:nanido]][game_stage] > local_data[:shot_count]
local_data[:ranking][local_data[:nanido]][game_stage] = local_data[:shot_count]
end
if game_stage < 4
scene_change :scene_next
else
local_data[:clearflg][local_data[:nanido]] = true
scene_change :scene_staff
#scene_change :scene_title
end
else
local_data[:wait_count] += 1
end
else
local_data[:wait_count] += 1
end
when 6
if local_data[:wait_count] == 0
local_data[:life] -= 1
life_c_s[0].copy_rect 0, 0
life_c_s[1].copy_rect local_data[:life], 0
local_data[:char_pos3][0] = (-32)
local_data[:char_pos3][1] = (-32)
char_s3.set_position local_data[:char_pos3][0], local_data[:char_pos3][1]
local_data[:char_pos2][0] = (-32)
local_data[:char_pos2][1] = (-32)
char_s2.set_position local_data[:char_pos2][0], local_data[:char_pos2][1]
(0...10).each do |i|
gage_s[i].copy_rect 3, 2
end
end
if local_data[:wait_count] > 155
if local_data[:life] > 0
pos_x = 5 * 32
pos_y = 13 * 32 + 1
local_data[:char_pos][0] = pos_x
local_data[:char_pos][1] = pos_y
char_s.copy_rect 5, local_data[:omake] * 8 #0
char_s.set_position local_data[:char_pos][0], local_data[:char_pos][1]
local_data[:char_muki] = 5 #0
char_s.copy_rect local_data[:char_muki], local_data[:omake] * 8 #0
char_s.change_motion :taiki
local_data[:wait_count] = 0
local_data[:cursor_wait] = 0
local_data[:cursor_act] = 0
local_data[:game_mode] = 1
else
if local_data[:wait_count] == 156
#ゲームオーバー
(0...7).each do |i|
pos_x = (i + 5) * 48 - 8
pos_y = 6 * 32
s = scene.add :image, :template => :tmp_str_stage, :position => [pos_x, pos_y], :z_order => 7
s.copy_rect i, 11
pos_y += 32
s = scene.add :image, :template => :tmp_str_stage, :position => [pos_x, pos_y], :z_order => 7
s.copy_rect i, 12
end
end
if local_data[:wait_count] > 330
local_data[:wait_count] = 0
set_save_data
scene_change :scene_title
#local_data[:game_mode] = 7
else
local_data[:wait_count] += 1
end
end
else
local_data[:wait_count] += 1
end
end
#ボスの移動
if game_stage == 4
pos_x = local_data[:boss_pos][0]
pos_y = local_data[:boss_pos][1]
boss_mot = boss_s.get_data :motion
case boss_mot
when 1
if local_data[:boss_wait] > 2
pos_y += 1
local_data[:boss_wait] = 0
else
local_data[:boss_wait] += 1
end
if pos_y > 39
local_data[:boss_wait] = 0
boss_mot = rand(4) + 2
boss_s.set_data :motion, boss_mot
end
when 2
if (local_data[:boss_wait] % 2) == 0
pos_x += 2
pos_y += 1
end
local_data[:boss_wait] += 1
if (local_data[:boss_wait] > 40) || (pos_x > (32 * 18)) || (pos_y > (32 * 7))
if (pos_x > (32 * 18))
pos_x = (32 * 18)
end
if (pos_y > (32 * 7))
pos_y = (32 * 7)
end
local_data[:boss_wait] = 0
while boss_mot == 2
boss_mot = rand(4) + 2
end
boss_s.set_data :motion, boss_mot
end
when 3
if (local_data[:boss_wait] % 2) == 0
pos_x -= 2
pos_y += 1
end
local_data[:boss_wait] += 1
if (local_data[:boss_wait] > 40) || (pos_x < (32 * 5)) || (pos_y > (32 * 7))
if (pos_x < (32 * 5))
pos_x = (32 * 5)
end
if (pos_y > (32 * 7))
pos_y = (32 * 7)
end
local_data[:boss_wait] = 0
while boss_mot == 3
boss_mot = rand(4) + 2
end
boss_s.set_data :motion, boss_mot
end
when 4
if (local_data[:boss_wait] % 2) == 0
pos_x += 2
pos_y -= 1
end
local_data[:boss_wait] += 1
if (local_data[:boss_wait] > 40) || (pos_x > (32 * 18)) || (pos_y < (32 * 1))
if (pos_x > (32 * 18))
pos_x = (32 * 18)
end
if (pos_y < (32 * 1))
pos_y = (32 * 1)
end
local_data[:boss_wait] = 0
while boss_mot == 4
boss_mot = rand(4) + 2
end
boss_s.set_data :motion, boss_mot
end
when 5
if (local_data[:boss_wait] % 2) == 0
pos_x -= 2
pos_y -= 1
end
local_data[:boss_wait] += 1
if (local_data[:boss_wait] > 40) || (pos_x < (32 * 5)) || (pos_y < (32 * 1))
if (pos_x < (32 * 5))
pos_x = (32 * 5)
end
if (pos_y < (32 * 1))
pos_y = (32 * 1)
end
local_data[:boss_wait] = 0
while boss_mot == 5
boss_mot = rand(4) + 2
end
boss_s.set_data :motion, boss_mot
end
when 10
if local_data[:boss_wait] > 16
wrk_pos_x = pos_x + 4 + rand(22)
wrk_pos_y = pos_y + 4 + rand(22)
bomb_s.set_position wrk_pos_x, wrk_pos_y
bomb_s.change_animation :ani_bomb
local_data[:boss_wait] = 0
else
local_data[:boss_wait] += 1
end
if local_data[:boss_wait] == 0
pos_x += 4
elsif (local_data[:boss_wait] % 2) == 0
pos_x += 4
else
pos_x -= 4
end
pos_y -= 1
if local_data[:boss_wait2] > 135
if local_data[:game_mode] != 5
local_data[:wait_count] = 0
end
local_data[:game_mode] = 5
else
local_data[:boss_wait2] += 1
end
end
local_data[:boss_pos][0] = pos_x
local_data[:boss_pos][1] = pos_y
boss_s.set_position local_data[:boss_pos][0], local_data[:boss_pos][1]
boss_s_cpos = boss_s.get_center_position
#view_sp.set_text "モーション #{local_data[:boss_mot]}\n X #{local_data[:boss_pos][0]} : Y #{local_data[:boss_pos][1]}\n X #{boss_s_cpos[0]} Y #{boss_s_cpos[1]}"
end
#if local_data[:shot_view_wait] > 1
# local_data[:shot_view_wait] -= 1
#elsif local_data[:shot_view_wait] > 0
# pos_x = (-32)
# pos_y = (-32)
# (0...4).each do |i|
# shotc_s[i].set_position pos_x, pos_y
# end
# local_data[:shot_view_wait] -= 1
#else
#
#end
if local_data[:ren_hit] > 0
local_data[:ren_hit] -= 1
end
end
end
end
#シーン 次のステージへ
scene :scene_next do |scene|
local_data[:wait_count] = 0
view_sp = scene.text :position => [10, 10], :z_order => 99
view_sp.set_text_area_size 200, 40
view_sp.set_font_point_size 18
scene.on_init do
s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [-32, -32], :z_order => 0
s_dummy.copy_rect 0, 0
local_data[:stage] += 1
scene_change :scene_main
#使用データのロード
scene.event :game_count, :on_step do
end
end
end
#シーン ゲームランキング
scene :scene_ranking do |scene|
local_data[:wait_count] = 0
view_sp = scene.text :position => [10, 10], :z_order => 99
view_sp.set_text_area_size 200, 40
view_sp.set_font_point_size 18
select_mode = 0
nanido = 0
s_bg = []
s_nanido = []
shot_s = []
scene.on_init do
s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [-32, -32], :z_order => 0
s_dummy.copy_rect 0, 0
#使用データのロード
#メインウインドウ
(0...140).each do |i|
pos_x = (i % 10)
if pos_x > 4
pos_x += 15
end
pos_x *= 32
pos_y = ((i / 10).to_i) * 32 + 1
s = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
if (i % 10) == 4 then
s.copy_rect 1, 2
elsif (i % 10) == 5 then
s.copy_rect 2, 2
else
s.copy_rect 0, 2
end
end
#背景
(0...210).each do |i|
pos_x = ((i % 15) + 5) * 32
pos_y = ((i / 15).to_i) * 32 + 1
pos_r = rand(5)
if pos_r > 3
pos_r = 0
end
s_bg[i] = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
s_bg[i].copy_rect pos_r, 3
s_bg[i].set_color 170, 170, 170, 255
end
#らんきんぐ
pos_x = 32 * 9 + 16
pos_y = 32
(0...3).each do |i|
s = scene.add :image, :template => :tmp_str_mode, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 1, 13 + i
pos_y += 16
end
#MODE
pos_x = 32 * 10 - 8
pos_y = 32 * 3
(0...2).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 16 + i, 9
pos_x += 32
end
pos_x += 16
(0...3).each do |i|
s_nanido[i] = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s_nanido[i].copy_rect 8 + i, 0
pos_x += 32
end
#STAGE
pos_y = 32 * 4 + 16
(0...5).each do |i|
pos_x = 32 * 8 - 8
(0...3).each do |j|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 12 + j, 6
pos_x += 32
end
#(0...3).each do |j|
s = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 1 + i, 0
#pos_x += 32
#end
pos_x += 64
(0...2).each do |j|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 18 + j, 4
pos_x += 32
end
pos_x += 16
#(0...2).each do |j|
shot_s[i] = []
shot_s[i][0] = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 2
shot_s[i][0].copy_rect ((local_data[:ranking][nanido][i]) / 10).to_i, 0
pos_x += 16
shot_s[i][1] = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 2
shot_s[i][1].copy_rect ((local_data[:ranking][nanido][i]) % 10), 0
#end
pos_y += (32 + 16)
end
#EXIT
pos_x = 32 * 11 + 16
pos_y = 32 * 12
(0...2).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 18 + i, 9
pos_x += 32
end
#カーソル(主人公)
pos_cur_x = (8 * 32)
pos_cur_y = (3 * 32) + 1
s_cur = scene.add :image, :template => :tmp_mainchar, :position => [pos_cur_x, pos_cur_y], :z_order => 3
s_cur.copy_rect 0, local_data[:omake] * 8 #s_cur.copy_rect 0, 0
pos_cur_s = s_cur.get_position
#ボタン ↑
s_btn_up = scene.add :image, :name => :nm_btn_up, :template => :tmp_btn, :position => [0, (4 * 32) + 1], :z_order => 5
s_btn_up.copy_rect 1, 0
s_btn_up.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_up, :on_touch_up do
if select_mode > 0
select_mode -= 1
#wrk_scale = s_cur.get_scale
#if wrk_scale[1] != 1
# #pos_center = s_cur.get_center_position
# #s_cur.set_center_position pos_center[0], pos_center[1] + 20
# s_cur.set_scale 1, 1
#end
pos_cur_s[1] -= (9 * 32)
s_cur.set_position pos_cur_s[0], pos_cur_s[1]
end
s_btn_up.change_motion :up
#view_sp.set_text "メニュー #{select_mode}"
end
scene.event :nm_btn_up, :on_touch_down do
s_btn_up.change_motion :down
end
#ボタン ↓
s_btn_down = scene.add :image, :name => :nm_btn_down, :template => :tmp_btn, :position => [0, (9 * 32) + 1], :z_order => 5
s_btn_down.copy_rect 1, 1
s_btn_down.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_down, :on_touch_up do
if select_mode < 1
select_mode += 1
#wrk_scale = s_cur.get_scale
#if wrk_scale[1] != 1
# #pos_center = s_cur.get_center_position
# #s_cur.set_center_position pos_center[0], pos_center[1] + 20
# s_cur.set_scale 1, 1
#end
pos_cur_s[1] += (9 * 32)
s_cur.set_position pos_cur_s[0], pos_cur_s[1]
end
s_btn_down.change_motion :up
#view_sp.set_text "メニュー #{select_mode}"
end
scene.event :nm_btn_down, :on_touch_down do
s_btn_down.change_motion :down
end
#ボタン ○
s_btn_maru = scene.add :image, :name => :nm_btn_maru, :template => :tmp_btn, :position => [(20 * 32), (9 * 32) + 1], :z_order => 5
s_btn_maru.copy_rect 3, 1
s_btn_maru.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_maru, :on_touch_up do
case select_mode
when 0 then
#難易度変更
nanido += 1
if (nanido > 2 && !(local_data[:clearflg][2])) || (nanido > 3)
nanido = 0
end
(0...210).each do |i|
pos_r = rand(5)
if pos_r > 3
pos_r = 0
end
s_bg[i].copy_rect pos_r, 3 + nanido
end
(0...3).each do |i|
s_nanido[i].copy_rect 8 + i + 3 * nanido, 0
end
(0...5).each do |i|
shot_s[i][0].copy_rect ((local_data[:ranking][nanido][i]) / 10).to_i, 0
shot_s[i][1].copy_rect ((local_data[:ranking][nanido][i]) % 10), 0
end
when 1 then
#タイトルへ
scene_change :scene_title
end
s_btn_maru.change_motion :up
end
scene.event :nm_btn_maru, :on_touch_down do
s_btn_maru.change_motion :down
end
scene.event :game_count, :on_step do
end
end
end
#シーン ゲームオプション
scene :scene_option do |scene|
local_data[:wait_count] = 0
view_sp = scene.text :position => [10, 10], :z_order => 99
view_sp.set_text_area_size 200, 40
view_sp.set_font_point_size 18
select_mode = 0
nanido = local_data[:nanido]
start_stage = local_data[:start_stage]
bgm = local_data[:bgm]
sound = local_data[:sound]
seacret = local_data[:clearflg][3]
s_bg = []
s_nanido = []
s_bgm = []
s_sound = []
scene.on_init do
s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [-32, -32], :z_order => 0
s_dummy.copy_rect 0, 0
#使用データのロード
#メインウインドウ
(0...140).each do |i|
pos_x = (i % 10)
if pos_x > 4
pos_x += 15
end
pos_x *= 32
pos_y = ((i / 10).to_i) * 32 + 1
s = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
if (i % 10) == 4 then
s.copy_rect 1, 2
elsif (i % 10) == 5 then
s.copy_rect 2, 2
else
s.copy_rect 0, 2
end
end
#背景
(0...210).each do |i|
pos_x = ((i % 15) + 5) * 32
pos_y = ((i / 15).to_i) * 32 + 1
pos_r = rand(5)
if pos_r > 3
pos_r = 0
end
s_bg[i] = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
s_bg[i].copy_rect pos_r, 3
s_bg[i].set_color 170, 170, 170, 255
end
#おぷしょん
pos_x = 32 * 9 + 16
pos_y = 32
(0...3).each do |i|
s = scene.add :image, :template => :tmp_str_mode, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 1, 16 + i
pos_y += 16
end
#MODE
pos_x = 32 * 10 - 8
pos_y = 32 * 3
(0...2).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 16 + i, 9
pos_x += 32
end
pos_x += 16
(0...3).each do |i|
s_nanido[i] = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s_nanido[i].copy_rect (8 + i + 3 * nanido), 0
pos_x += 32
end
#STAGE
pos_x = 32 * 10 - 16
if seacret
pos_y = 32 * 4 + 16
else
pos_y = 32 * 5
end
(0...3).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 12 + i, 6
pos_x += 32
end
#pos_x += 16
s_stage = scene.add :image, :template => :tmp_str_16, :position => [pos_x, pos_y], :z_order => 2
s_stage.copy_rect (start_stage + 1), 0
#BGM
pos_x = 32 * 10 - 14
if seacret
pos_y = 32 * 6
else
pos_y = 32 * 7
end
(0...2).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 15 + i, 5
pos_x += 32
end
pos_x += 30
(0...2).each do |i|
s_bgm[i] = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
pos_x += 32
end
if bgm
s_bgm[0].copy_rect 12, 9
s_bgm[1].copy_rect 13, 9
else
s_bgm[0].copy_rect 14, 9
s_bgm[1].copy_rect 15, 9
end
#SOUND
pos_x = 32 * 10 - 16
if seacret
pos_y = 32 * 7 + 16
else
pos_y = 32 * 9
end
(0...3).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 17 + i, 5
pos_x += 32
end
(0...2).each do |i|
s_sound[i] = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
pos_x += 32
end
if sound
s_sound[0].copy_rect 12, 9
s_sound[1].copy_rect 13, 9
else
s_sound[0].copy_rect 14, 9
s_sound[1].copy_rect 15, 9
end
if seacret
#OMAKE
pos_x = 32 * 10 - 16
pos_y = 32 * 9
(0...3).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 14 + i, 12
pos_x += 32
end
end
#EXIT
pos_x = 32 * 11 + 16
if seacret
pos_y = 32 * 10 + 16
else
pos_y = 32 * 11
end
(0...2).each do |i|
s = scene.add :image, :template => :tmp_str_32, :position => [pos_x, pos_y], :z_order => 2
s.copy_rect 18 + i, 9
pos_x += 32
end
#カーソル(主人公)
pos_cur_x = (8 * 32)
pos_cur_y = (3 * 32) + 1
s_cur = scene.add :image, :template => :tmp_mainchar, :position => [pos_cur_x, pos_cur_y], :z_order => 3
s_cur.copy_rect 0, local_data[:omake] * 8 #s_cur.copy_rect 0, 0
pos_cur_s = s_cur.get_position
#ボタン ↑
s_btn_up = scene.add :image, :name => :nm_btn_up, :template => :tmp_btn, :position => [0, (4 * 32) + 1], :z_order => 5
s_btn_up.copy_rect 1, 0
s_btn_up.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_up, :on_touch_up do
if select_mode > 0
select_mode -= 1
#wrk_scale = s_cur.get_scale
#if wrk_scale[1] != 1
# #pos_center = s_cur.get_center_position
# #s_cur.set_center_position pos_center[0], pos_center[1] + 20
# s_cur.set_scale 1, 1
#end
if seacret
pos_cur_s[1] -= 48
else
pos_cur_s[1] -= 64
end
s_cur.set_position pos_cur_s[0], pos_cur_s[1]
end
s_btn_up.change_motion :up
#view_sp.set_text "メニュー #{select_mode}"
end
scene.event :nm_btn_up, :on_touch_down do
s_btn_up.change_motion :down
end
#ボタン ↓
s_btn_down = scene.add :image, :name => :nm_btn_down, :template => :tmp_btn, :position => [0, (9 * 32) + 1], :z_order => 5
s_btn_down.copy_rect 1, 1
s_btn_down.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_down, :on_touch_up do
if select_mode < 4 || (select_mode < 5 && seacret)
select_mode += 1
#wrk_scale = s_cur.get_scale
#if wrk_scale[1] != 1
# #pos_center = s_cur.get_center_position
# #s_cur.set_center_position pos_center[0], pos_center[1] + 20
# s_cur.set_scale 1, 1
#end
if seacret
pos_cur_s[1] += 48
else
pos_cur_s[1] += 64
end
s_cur.set_position pos_cur_s[0], pos_cur_s[1]
end
s_btn_down.change_motion :up
#view_sp.set_text "メニュー #{select_mode}"
end
scene.event :nm_btn_down, :on_touch_down do
s_btn_down.change_motion :down
end
#ボタン ○
s_btn_maru = scene.add :image, :name => :nm_btn_maru, :template => :tmp_btn, :position => [(20 * 32), (9 * 32) + 1], :z_order => 5
s_btn_maru.copy_rect 3, 1
s_btn_maru.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_maru, :on_touch_up do
exit = false
case select_mode
when 0 then
#難易度
nanido += 1
if (nanido > 2 && !(local_data[:clearflg][2])) || (nanido > 3)
nanido = 0
end
(0...3).each do |i|
s_nanido[i].copy_rect 8 + i + 3 * nanido, 0
end
start_stage = 0
s_stage.copy_rect (start_stage + 1), 0
when 1 then
#ステージ
if local_data[:clearflg][nanido]
start_stage += 1
if start_stage > 4
start_stage = 0
end
s_stage.copy_rect (start_stage + 1), 0
end
when 2 then
#BGM
#bgm = !(bgm)
if bgm
s_bgm[0].copy_rect 12, 9
s_bgm[1].copy_rect 13, 9
else
s_bgm[0].copy_rect 14, 9
s_bgm[1].copy_rect 15, 9
end
when 3 then
#サウンド
#sound = !(sound)
if sound
s_sound[0].copy_rect 12, 9
s_sound[1].copy_rect 13, 9
else
s_sound[0].copy_rect 14, 9
s_sound[1].copy_rect 15, 9
end
when 4 then
if seacret
if local_data[:omake] < 1
local_data[:omake] = 1
else
local_data[:omake] = 0
end
s_cur.copy_rect 0, local_data[:omake] * 8
else
exit = true
end
when 5 then
exit = true
end
if exit
local_data[:nanido] = nanido
local_data[:start_stage] = start_stage
local_data[:bgm] = bgm
local_data[:sound] = sound
set_save_data
#タイトルへ
scene_change :scene_title
end
s_btn_maru.change_motion :up
end
scene.event :nm_btn_maru, :on_touch_down do
s_btn_maru.change_motion :down
end
scene.event :game_count, :on_step do
end
end
end
#シーン ゲームスタッフ
scene :scene_staff do |scene|
local_data[:wait_count] = 1
view_sp = scene.text :position => [10, 10], :z_order => 99
view_sp.set_text_area_size 200, 40
view_sp.set_font_point_size 18
view_msg = scene.text :position => [(32 * 6), (32 * 9)], :z_order => 99
view_msg.set_text_area_size (32 * 13), (32 * 5)
view_msg.set_font_point_size 18
local_data[:btn_flg] = false
bonus_str = ["たまちゃんをタップしてみよう","たまちゃんを5回タップしてみよう","EXの左上あたりを5回タップしてみよう","ボタンを↑↑↓↓↑↓↑↓と押した後、\nたまちゃんをタップしてみよう"]
rank_str = ["EASY","NORMAL","HARD","MUCHA"]
msg_flg = false
max_time = 1300 #1080
scene.on_init do
s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [-32, -32], :z_order => 0
s_dummy.copy_rect 0, 0
#使用データのロード
#メインウインドウ
(0...140).each do |i|
pos_x = (i % 10)
if pos_x > 4
pos_x += 15
end
pos_x *= 32
pos_y = ((i / 10).to_i) * 32 + 1
s = scene.add :image, :template => :tmp_char, :position => [pos_x, pos_y], :z_order => 1
if (i % 10) == 4 then
s.copy_rect 1, 2
elsif (i % 10) == 5 then
s.copy_rect 2, 2
else
s.copy_rect 0, 2
end
end
#ボタン ○
s_btn_maru = scene.add :image, :name => :nm_btn_maru, :template => :tmp_btn, :position => [(20 * 32), (9 * 32) + 1], :z_order => 5
s_btn_maru.copy_rect 3, 1
s_btn_maru.collision :rect, :mode => :left_top, :position => [0, 0], :width => [160, 160]
scene.event :nm_btn_maru, :on_touch_up do
if local_data[:wait_count] > max_time && !(local_data[:btn_flg])
set_save_data
#タイトルへ
scene_change :scene_title
end
local_data[:btn_flg] = false
s_btn_maru.change_motion :up
end
scene.event :nm_btn_maru, :on_touch_down do
if local_data[:wait_count] < max_time
local_data[:btn_flg] = true
end
s_btn_maru.change_motion :down
end
#スタッフリスト
str_y_st = 32 * 17
str_c = 0
str_x = 0
str_s = []
#STAFF
(0...3).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((11 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (14 + i), 1
str_c += 1
end
#MAIN SYSTEM
str_x += 3
(0...6).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((9 + i) * 32 + 16), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (14 + i), 3
str_c += 1
end
#Rmake
str_x += 2
(0...3).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((11 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (17 + i), 1
str_c += 1
end
#SCRIPT
str_x += 3
(0...3).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((11 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (12 + i), 5
str_c += 1
end
#AoiHikawa
str_x += 2
(0...5).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((10 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (15 + i), 6
str_c += 1
end
#GRAPHIC
str_x += 3
(0...4).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((10 + i) * 32 + 16), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (14 + i), 4
str_c += 1
end
#AoiHikawa
str_x += 2
(0...5).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((10 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (15 + i), 6
str_c += 1
end
#SpecalThanks
str_x += 3
(0...6).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((9 + i) * 32 + 16), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (14 + i), 2
str_c += 1
end
#Akasata
str_x += 2
(0...3).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((9 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (15 + i), 10
str_c += 1
end
#dycoon
(0...3).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((13 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (14 + i), 11
str_c += 1
end
#Torica
str_x += 2
(0...3).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((9 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (12 + i), 10
str_c += 1
end
#OSA
#(0...2).each do |i|
# str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((10 + i) * 32), (str_y_st + (str_x * 32))], :z_order => 3
# str_s[str_c].copy_rect (15 + i), 6
# str_c += 1
#end
#Thank you for playing
str_x += 8
(0...8).each do |i|
str_s[str_c] = scene.add :image, :template => :tmp_str_32, :position => [((8 + i) * 32 + 16), (str_y_st + (str_x * 32))], :z_order => 3
str_s[str_c].copy_rect (12 + i), 8
str_c += 1
end
#str_c -= 1
scene.event :game_count, :on_step do
if local_data[:wait_count] > max_time
if !(msg_flg)
msg_str = "クリアおめでとう\nタイトル画面で、\n"
msg_str += bonus_str[local_data[:nanido]]
msg_str += "\n"
msg_str += rank_str[local_data[:nanido]]
msg_str += "以下のランクが、クリア状態になるよ"
view_msg.set_text msg_str
msg_flg = true
end
else
if (local_data[:wait_count] % 2) == 0
#画面スクロール
(0...str_c).each do |i|
pos_str_c = str_s[i].get_position
str_s[i].set_position pos_str_c[0], (pos_str_c[1] - 2)
end
end
local_data[:wait_count] += 1
if local_data[:btn_flg] && (local_data[:wait_count] % 2) == 1
local_data[:wait_count] += 1
end
end
#view_sp.set_text "WAIT #{local_data[:wait_count]}"
end
end
end
#シーン ゲーム終了
scene :scene_exit do |scene|
scene.on_init do
#speak "終了します"
set_save_data
#ゲーム終了
game.change_project "start_menu"
end
end