ゲーム 800x450 公開中

Rmakeレーン

投稿者:@AoiHikawa 投稿日時: 2013/09/26 23:42:13
閲覧: 944 評価: 60
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
あなたはまだ評価していません。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/ # Rmakeれーん Ver.0.83 # # (c)2013 こらとらる AoiHikawa #_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #GC.disable game.draw_collision_mode false (0...57).each do |i| ((i + 1)...57).each do |j| game.collision_group_pair (i + 1), (j + 1), true end end #グローバル変数の格納場所 LOCAL_DATA_CONSTANT = {} def local_data LOCAL_DATA_CONSTANT end #データのロード game.loading do |ld| ld.add :img_logo, 88 ld.add :img_base, 221 ld.add :img_char, 350 ld.add :img_str, 207 ld.add :img_name, 348 ld.add :img_cole, 212 ld.add :img_zisyo, 256 ld.add :img_data_a, 332 ld.add :img_data_b, 347 ld.load_data :save_data, "savefile", :scope => :private end #ゲーム開始 game.on_init do scene_change :scene_logo #scene_change :scene_main end sys_max_data = 92 #_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #関数 def set_save_data c = 0 data = [] data[c] = local_data[:play_count] c += 1 data[c] = local_data[:high_score] c += 1 data[c] = local_data[:max_char] c += 1 (0...500).each do |i| (0...4).each do |j| data[c] = local_data[:get_item][i][j] c += 1 end end data[c] = local_data[:botton_mode] c += 1 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[:play_count] = data[c] c += 1 local_data[:high_score] = data[c] c += 1 local_data[:max_char] = data[c] c += 1 local_data[:get_item] = [] (0...500).each do |i| local_data[:get_item][i] = [] (0...4).each do |j| local_data[:get_item][i][j] = data[c] c += 1 end end if !(data[c]) local_data[:botton_mode] = 0 else local_data[:botton_mode] = data[c] end c += 1 #speak "#{data}" end #def get_h n0, x0, y0, n1, x1, y1 # #r = 0 # #x = 0 # #y = 0 # # # #if x0 == x1 # # if y0 > y1 # # y = (spd * (-1)) # # elsif y0 < y1 # # y = spd # # else # # # # end # #else # # r = ((Math.atan2 (y1 - y0), (x1 - x0)) + 0) # # # # x = (Math.cos(r) * spd).to_i # # y = (Math.sin(r) * spd).to_i # #end # # r = 32 # M = 1 # E = 0.3 # # # apx = local_data[:s_hit_pos][n0][0] # apy = local_data[:s_hit_pos][n0][1] # # bpx = local_data[:s_hit_pos][n1][0] # bpy = local_data[:s_hit_pos][n1][1] # # # vx = (apx - bpx) # vy = (apy - bpy) # len = Math.sqrt(vx * vx + vy * vy); # distance = r + r + 1 - len; # # if len > 0 # len = 1 / len # end # vx *= len # vy *= len # # distance /= 2.0 # # apx += vx * distance # apy += vy * distance # bpx -= vx * distance # bpy -= vy * distance # # local_data[:s_hit_pos][n0][0] = apx # local_data[:s_hit_pos][n0][1] = apy # # local_data[:s_hit_pos][n1][0] = bpx # local_data[:s_hit_pos][n1][1] = bpy # # # vx = (bpx - apx) # vy = (bpy - apy) # # t = -(vx * x0 + vy * y0) / (vx * vx + vy * vy) # arx = x0 + vx * t # ary = y0 + vy * t # # t = -(-vy * x0 + vx * y0) / (vy * vy + vx * vx) # amx = x0 - vy * t # amy = y0 + vx * t # # t = -(vx * x1 + vy * y1) / (vx * vx + vy * vy) # brx = x1 + vx * t # bry = y1 + vy * t # # t = -(-vy * x1 + vx * y1) / (vy * vy + vx * vx) # bmx = x1 - vy * t # bmy = y1 + vx * t # # # # adx = (M * amx + M * bmx + bmx * E * M - amx * E * M) / (M + M) # bdx = - E * (bmx - amx) + adx # ady = (M * amy + M * bmy + bmy * E * M - amy * E * M) / (M + M) # bdy = - E * (bmy - amy) + ady # # adx = adx + arx # ady = ady + ary # bdx = bdx + brx # bdy = bdy + bry # # ret_data = [adx, ady, bdx, bdy] # # #return # ret_data #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_hit do |st| st.texture :img_logo st.src_size 1, 1 st.dest_size 1, 1 st.center_offset 0, 0 end sprite_template :tmp_base do |st| st.texture :img_base st.src_size 800, 450 st.dest_size 800, 450 st.center_offset 0, 0 end sprite_template :tmp_colect do |st| st.texture :img_cole st.src_size 800, 450 st.dest_size 800, 450 st.center_offset 0, 0 end sprite_template :tmp_tana do |st| st.texture :img_cole st.src_size 800, 100 st.dest_size 800, 100 st.center_offset 0, 0 end sprite_template :tmp_name do |st| st.texture :img_name st.src_size 320, 32 st.dest_size 320, 32 st.center_offset 0, 0 end sprite_template :tmp_obj_01 do |st| st.texture :img_base st.src_size 200, 72 st.dest_size 200, 72 st.center_offset 0, 0 end sprite_template :tmp_obj_02 do |st| st.texture :img_base st.src_size 200, 535 st.dest_size 200, 535 st.center_offset 0, 0 end sprite_template :tmp_obj_03 do |st| st.texture :img_base st.src_size 25, 45 st.dest_size 25, 45 end sprite_template :tmp_obj_04 do |st| st.texture :img_base st.src_size 16, 45 st.dest_size 16, 45 end sprite_template :tmp_char do |st| st.texture :img_char st.src_size 96, 96 st.dest_size 96, 96 st.center_offset 0, 0 end sprite_template :tmp_str_01 do |st| st.texture :img_str st.src_size 32 * 23, 32 * 8 st.dest_size 32 * 23, 32 * 8 end sprite_template :tmp_str_02 do |st| st.texture :img_str st.src_size 32 * 8, 32 * 3 st.dest_size 32 * 8, 32 * 3 end sprite_template :tmp_str_03 do |st| st.texture :img_str st.src_size 32 * 5, 32 * 2 st.dest_size 32 * 5, 32 * 2 end sprite_template :tmp_str_04 do |st| st.texture :img_str st.src_size 32 * 3, 32 * 1 st.dest_size 32 * 3, 32 * 1 end sprite_template :tmp_str_05 do |st| st.texture :img_str st.src_size 32 * 1, 32 * 1 st.dest_size 32 * 1, 32 * 1 end sprite_template :tmp_str_05_s do |st| st.texture :img_str st.src_size 32 * 1, 32 * 1 st.dest_size 32 * 1, 32 * 1 st.center_offset 0, 0 st.motion :default do |cm| cm.proc_call do |sp| sp.set_scale 0.5, 0.5 end end end sprite_template :tmp_str_06 do |st| st.texture :img_str st.src_size 32 * 7, 32 * 2 st.dest_size 32 * 7, 32 * 2 end sprite_template :tmp_str_07 do |st| st.texture :img_str st.src_size 32 * 4, 32 * 2 st.dest_size 32 * 4, 32 * 2 end sprite_template :tmp_str_08 do |st| st.texture :img_str st.src_size 32 * 4, 32 * 1 st.dest_size 32 * 4, 32 * 1 end sprite_template :tmp_data_a do |st| st.texture :img_data_a st.src_size 400, 174 st.dest_size 400, 174 #st.render_way_type :add end sprite_template :tmp_data_b do |st| st.texture :img_data_b st.src_size 400, 174 st.dest_size 400, 174 #st.render_way_type :add end sprite_template :tmp_zisyo do |st| st.texture :img_zisyo st.src_size 400, 174 st.dest_size 400, 174 end sprite_template :tmp_zisyo_b do |st| st.texture :img_zisyo st.src_size 32, 48 st.dest_size 32, 48 end #_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #シーン ロゴ表示 scene :scene_logo do |scene| if game.loaded_data_result[:save_data][:success] get_save_data else local_data[:play_count] = 0 local_data[:high_score] = 0 local_data[:max_char] = 10 local_data[:get_item] = [] (0...500).each do |i| local_data[:get_item][i] = [0,0,0,0] end local_data[:botton_mode] = 0 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 local_data[:wait_count] = 0 gametime = Time.now gametime_co = 0 gametime_chk = 0 scene.on_init do s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [(-100), (-100)], :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 #scene_change :scene_main else #ダミーで領域を確保する s_dummy2 = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [(-100), (-100)], :z_order => 0 s_dummy2.copy_rect 0, 0 ##s_dummy2.delete # local_data[:wait_count] += 1 end gametime_now = Time.now if gametime_chk == 0 if ((gametime_now - gametime).to_i > 1) local_data[:Cspd1] = ((120 / gametime_co) * 4).to_i local_data[:Cspd2] = ((120 / gametime_co) * 2).to_i gametime_chk = 1 end gametime_co += 1 else #view_sp.set_text "待機時間 #{gametime_co}" end #view_sp.set_text "待機時間 #{local_data[:botton_mode]}" end end end #シーン タイトル scene :scene_title do |scene| 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 local_data[:wait_count] = 0 Cx = 50 Cy = 100 Cspd1 = local_data[:Cspd1] Cx2 = 120 select_mode = 0 select_mode_old = 0 scene.on_init do s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [(-100), (-100)], :z_order => 0 s_dummy.copy_rect 0, 0 #ボタン s_btn = scene.add :image, :name => :nm_s_btn0, :template => :tmp_hit, :position => [395, 395], :z_order => 5 s_btn.copy_rect 1, 1 s_btn.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 s_btn1 = scene.add :image, :name => :nm_s_btn, :template => :tmp_hit, :position => [745, 395], :z_order => 5 s_btn1.copy_rect 1, 1 s_btn1.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 s_btn2 = scene.add :image, :name => :nm_s_btn1, :template => :tmp_hit, :position => [745, 0], :z_order => 5 s_btn2.copy_rect 1, 1 s_btn2.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 scene.event :nm_s_btn0, :on_touch_up do #選択 if Cx2 != 50 select_mode += 1 if select_mode > 2 select_mode = 0 end case select_mode when 0 Cx2 = 120 when 1 Cx2 = 350 when 2 Cx2 = 595 end end end scene.event :nm_s_btn, :on_touch_up do #決定 case select_mode when 0 #scene_change :scene_main local_data[:botton_mode] = 0 Cx2 = 50 when 1 #コレクションへ scene_change :scene_colect when 2 #終了へ scene_change :scene_exit end end scene.event :nm_s_btn1, :on_touch_up do #決定 case select_mode when 0 #scene_change :scene_main local_data[:botton_mode] = 1 Cx2 = 50 when 1 #コレクションへ scene_change :scene_colect when 2 #終了へ scene_change :scene_exit end end #背景 s_base_01 = scene.add :image, :template => :tmp_base, :position => [0, 0], :z_order => 0 s_base_01.copy_rect 0, 1 s_base_01.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #前景 s_base_02 = scene.add :image, :template => :tmp_base, :position => [0, 0], :z_order => 5 s_base_02.copy_rect 0, 0 s_base_02.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #ボタン spx = 320 spy = 347 s_obj_01 = scene.add :image, :template => :tmp_obj_01, :position => [spx, spy], :z_order => 6 s_obj_01.copy_rect 4, 0 s_obj_01.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #クレーン本体 spx = (Cx - 34) spy = (Cy - 530) s_obj_02 = scene.add :image, :template => :tmp_obj_02, :position => [spx, spy], :z_order => 2 s_obj_02.copy_rect 4, 0 s_obj_02.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #クレーンアーム spx = (Cx - 9) spy = Cy s_obj_03_1 = scene.add :image, :template => :tmp_obj_03, :position => [spx, spy], :center_offset => [10,4], :z_order => 3 s_obj_03_1.copy_rect 33, 12 s_obj_03_1.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 s_obj_03_2 = scene.add :image, :template => :tmp_obj_03, :position => [74 + spx, spy], :center_offset => [20,4], :z_order => 2 s_obj_03_2.copy_rect 36, 12 s_obj_03_2.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 spx = 32 * 1 spy = 32 * 5 + 16 s_str_01 = scene.add :image, :template => :tmp_str_02, :position => [spx, spy], :z_order => 7 s_str_01.copy_rect 0, 3 s_str_01.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 spx = 32 * 8 + 16 s_str_02 = scene.add :image, :template => :tmp_str_02, :position => [spx, spy], :z_order => 7 s_str_02.copy_rect 1, 3 s_str_02.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 spx = 32 * 16 s_str_03 = scene.add :image, :template => :tmp_str_02, :position => [spx, spy], :z_order => 7 s_str_03.copy_rect 1, 3 s_str_03.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 spx = 32 * 1 + 16 spy = 32 * 6 s_str_04 = scene.add :image, :template => :tmp_str_06, :position => [spx, spy], :z_order => 8 s_str_04.copy_rect 0, 6 s_str_04.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 spx = 32 * 9 s_str_05 = scene.add :image, :template => :tmp_str_06, :position => [spx, spy], :z_order => 8 s_str_05.copy_rect 1, 6 s_str_05.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 spx = 32 * 18 s_str_06 = scene.add :image, :template => :tmp_str_07, :position => [spx, spy], :z_order => 8 s_str_06.copy_rect 4, 5 s_str_06.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 spx = 32 * 11 spy = 32 * 10 s_str_07 = scene.add :image, :template => :tmp_str_04, :position => [spx, spy], :z_order => 8 s_str_07.copy_rect 6, 8 s_str_07.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 spx = 32 * 21 s_str_07 = scene.add :image, :template => :tmp_str_08, :position => [spx, spy], :z_order => 8 s_str_07.copy_rect 4, 9 s_str_07.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 scene.event :game_count, :on_step do if select_mode_old != select_mode case select_mode when 0 s_str_03.copy_rect 1, 3 s_str_01.copy_rect 0, 3 when 1 s_str_01.copy_rect 1, 3 s_str_02.copy_rect 0, 3 when 2 s_str_02.copy_rect 1, 3 s_str_03.copy_rect 0, 3 end select_mode_old = select_mode end if Cx2 != Cx if Cx2 < Cx Cx -= Cspd1 if Cx2 > Cx Cx = Cx2 end else Cx += Cspd1 if Cx2 < Cx Cx = Cx2 end end spx = (Cx - 34) spy = (Cy - 530) s_obj_02.set_position spx, spy spx = (Cx - 9) spy = Cy s_obj_03_1.set_position spx, spy s_obj_03_2.set_position (74 + spx), spy elsif Cx2 == 50 scene_change :scene_main end end end end #シーン メイン scene :scene_main do |scene| local_data[:wait_count] = 0 play_count = local_data[:play_count] play_count += 1 local_data[:play_count] = play_count flame_min = (1 / 60) s_hit_count = 0 s_get_count = 0 s_hit = [] s_set = [] #設定データ G = 9.8 * 200 #9.8 M = 0.85 E = 0.4 E2 = 0.6 Lb = 20 Ld = 350 Ll = 180 Lh = 170 Cm = 0 Ca = 0 Clen = 30 Chit = 0 Cx = 50 Cy = 100 Cspd1 = local_data[:Cspd1] Cspd2 = local_data[:Cspd2] Wait1 = 15 Wait2 = 25 KaiS = (Math::PI / 36) Kco = 0 Kma = 5 Kwan = 10 Kwam = 10 Kkan = 5 #最大種類 rand_max = sys_max_data if local_data[:max_char] < rand_max rand_max = local_data[:max_char] end gametime = Time.now gametime_co = 0 gametime_max = 90 gametime_loss = 3 gametime_res = 0 Rco = 0 Rcop = 0 Rsh = 0 Rshli = [] oldtime = Time.now oldtime_v = Time.now v_flg = true 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 load_end = false scene.on_init do s_dummy = scene.add :image, :name => :game_count, :template => :tmp_hit, :position => [-32, -32], :z_order => 0 s_dummy.copy_rect 0, 0 #_/_/_/_/_/ イベント用 _/_/_/_/_/ #ボタン s_btn = scene.add :image, :name => :nm_s_btn0, :template => :tmp_hit, :position => [395, 395], :z_order => 5 s_btn.copy_rect 1, 1 s_btn.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 s_btn0 = scene.add :image, :name => :nm_s_btn, :template => :tmp_hit, :position => [200, 0], :z_order => 5 s_btn0.copy_rect 1, 1 s_btn0.collision :circle, :mode => :center, :position => [0, 0], :radius => 32, :group_id => 0 s_btn1 = scene.add :image, :name => :nm_s_btn1, :template => :tmp_hit, :position => [395, 395], :z_order => 5 s_btn1.copy_rect 1, 1 s_btn1.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 if local_data[:botton_mode] == 0 s_btn1.set_position 900, 500 elsif local_data[:botton_mode] == 1 s_btn.set_position 900, 500 end scene.event :nm_s_btn, :on_touch_up do end scene.event :nm_s_btn0, :on_touch_up do case Cm when 0 if gametime_res == 3 set_save_data #タイトルへ scene_change :scene_title end when 1 Cm = 7 end end scene.event :nm_s_btn0, :on_touch_down do if (gametime_co < 10) case Cm when 0 Cm = 1 end end end scene.event :nm_s_btn1, :on_touch_up do case Cm when 0 if gametime_res == 3 set_save_data #タイトルへ scene_change :scene_title else if (gametime_co < 10) Cm = 1 end end when 1 Cm = 7 end end #景品 (0...50).each do |i| s_set[i] = false if i < 25 r = 30 elsif i < 40 r = 33 else r = 36 end s_hit[i] = scene.add :image, :name => :nm_s_hit, :template => :tmp_hit, :position => [(-300), 0 + (i * 300)], :z_order => 5 s_hit[i].copy_rect 1, 1 s_hit[i].collision :circle, :mode => :center, :position => [0, 0], :radius => r, :group_id => (i + 1) s_hit[i].set_data :no, i s_hit[i].set_data :px, -300 s_hit[i].set_data :py, 0 + (i * 300) s_hit[i].set_data :dx, 0 s_hit[i].set_data :dy, 0 s_hit[i].set_data :hx, 3 s_hit[i].set_data :hy, 3 s_hit[i].set_data :r, r #(30 + 3 * (i / 20).to_i) s_hit[i].set_data :m, (32 - 12) s_hit[i].set_data :type, 1 s_hit[i].event :on_collision do |event| source = event.pair[0] another = event.pair[1] next unless another next unless source no1 = source.get_data :no no2 = another.get_data :no case s_hit[no2].get_data :type when 0 #バー px_a = s_hit[no1].get_data :px py_a = s_hit[no1].get_data :py dx_a = s_hit[no1].get_data :dx dy_a = s_hit[no1].get_data :dy hx_a = s_hit[no1].get_data :hx hy_a = s_hit[no1].get_data :hy r_a = s_hit[no1].get_data :r no_b = s_hit[no2].get_data :no px1_b = s_hit[no2].get_data :px py1_b = s_hit[no2].get_data :py r_b = s_hit[no2].get_rotation px2_b = px1_b + (Math.sin(r_b) * Clen) py2_b = py1_b + (Math.cos(r_b) * Clen) case no_b when 55 #右 when 56 #左 wrk = px1_b px1_b = px2_b px2_b = wrk wrk = py1_b py1_b = py2_b py2_b = wrk end #始点との当たり判定 sx = px_a - px1_b sy = py_a - py1_b if (sx * sx + sy * sy < r_a * r_a) #正規化 len = Math.sqrt((sx * sx) + (sy * sy)) if (len > 0) len = 1 / len end sx *= len sy *= len #位置補正 px_a = px1_b + sx * r_a py_a = py1_b + sy * r_a #反射方向 t = -(sx * dx_a + sy * dy_a) / (sx * sx + sy * sy) dx_a += t * sx * 2 * E2 dy_a += t * sy * 2 * E2 end #終点との当たり判定 sx = px_a - px2_b sy = py_a - py2_b if (sx * sx + sy * sy < r_a * r_a) #正規化 len = Math.sqrt((sx * sx) + (sy * sy)) if (len > 0) len = 1 / len end sx *= len sy *= len #位置補正 px_a = px2_b + sx * r_a py_a = py2_b + sy * r_a #反射方向 t = -(sx * dx_a + sy * dy_a) / (sx * sx + sy * sy) dx_a += t * sx * 2 * E2 dy_a += t * sy * 2 * E2 end #線分との当たり判定 #始点から終点のベクトル sx = px2_b - px1_b sy = py2_b - py1_b #ベクトルを正規化 len = Math.sqrt((sx * sx) + (sy * sy)) if (len > 0) len = 1 / len end sx *= len sy *= len #線の法線 nx = -(sy) ny = sx #交差する位置を調べる vx = -nx * r_a vy = -ny * r_a d = -(px1_b * nx + py1_b * ny) t = -(nx * px_a + ny * py_a + d) / (nx * vx + ny * vy) #交点 cx = px_a + t * vx cy = py_a + t * vy #位置補正 px_a = cx + r_a * nx py_a = cy + r_a * ny #反射方向 t = -(nx * dx_a + ny * dy_a) / (nx * nx + ny * ny) dx_a += t * nx * 2 * E2 dy_a += t * ny * 2 * E2 s_hit[no1].set_data :px, px_a s_hit[no1].set_data :py, py_a s_hit[no1].set_data :dx, dx_a s_hit[no1].set_data :dy, dy_a s_hit[no2].set_data :hit, ((s_hit[no2].get_data :hit) + r_a - 30) when 1 #景品 px_a = s_hit[no1].get_data :px py_a = s_hit[no1].get_data :py r_a = s_hit[no1].get_data :r px_b = s_hit[no2].get_data :px py_b = s_hit[no2].get_data :py r_b = s_hit[no2].get_data :r vx = (px_a - px_b) vy = (py_a - py_b) len = Math.sqrt(vx * vx + vy * vy) dis = r_a + r_b - len + 1 if len > 0 len = 1 / len end vx *= len vy *= len dis /= 2.0 px_a += vx * dis py_a += vy * dis px_b -= vx * dis py_b -= vy * dis if py_a > (Ld - r_a) && (px_a + r_a) > Ll py_a = (Ld - r_a - 1) end if py_b > (Ld - r_b) && (px_b + r_b) > Ll py_b = (Ld - r_b - 1) end dx_a = s_hit[no1].get_data :dx dy_a = s_hit[no1].get_data :dy hx_a = s_hit[no1].get_data :hx hy_a = s_hit[no1].get_data :hy m_a = s_hit[no1].get_data :m m_a = s_hit[no1].get_data :m if hx_a == 2 dx_a = -(dx_a) end if hy_a == 2 dy_a = -(dy_a) end dx_b = s_hit[no2].get_data :dx dy_b = s_hit[no2].get_data :dy hx_b = s_hit[no2].get_data :hx hy_b = s_hit[no2].get_data :hy if hx_b == 2 dx_b = -(dx_b) end if hy_b == 2 dy_b = -(dy_b) end m_b = s_hit[no2].get_data :m m_b = s_hit[no2].get_data :m vx = (px_b - px_a) vy = (py_b - py_a) ct = -(vx * dx_a + vy * dy_a) / (vx * vx + vy * vy) arx = dx_a + vx * ct ary = dy_a + vy * ct ct = -(-vy * dx_a + vx * dy_a) / (vy * vy + vx * vx) amx = dx_a - vy * ct amy = dy_a + vx * ct ct = -(vx * dx_b + vy * dy_b) / (vx * vx + vy * vy) brx = dx_b + vx * ct bry = dy_b + vy * ct ct = -(-vy * dx_b + vx * dy_b) / (vy * vy + vx * vx) bmx = dx_b - vy * ct bmy = dy_b + vx * ct adx = (m_a * amx + m_b * bmx + bmx * E2 * m_b - amx * E2 * m_b) / (m_a + m_b) bdx = - E2 * (bmx - amx) + adx ady = (m_a * amy + m_b * bmy + bmy * E2 * m_b - amy * E2 * m_b) / (m_a + m_b) bdy = - E2 * (bmy - amy) + ady dx_a = adx + arx dy_a = ady + ary dx_b = bdx + brx dy_b = bdy + bry if dx_a < 0 dx_a = -(dx_a) s_hit[no1].set_data :hx ,2 else s_hit[no1].set_data :hx ,1 end s_hit[no1].set_data :px ,px_a s_hit[no1].set_data :dx, dx_a if dy_a < 0 dy_a = -(dy_a) s_hit[no1].set_data :hy ,2 else s_hit[no1].set_data :hy ,1 end s_hit[no1].set_data :py ,py_a s_hit[no1].set_data :dy, dy_a if dx_b < 0 dx_b = -(dx_b) s_hit[no2].set_data :hx ,2 else s_hit[no2].set_data :hx ,1 end s_hit[no2].set_data :px ,px_b s_hit[no2].set_data :dx, dx_b if dy_b < 0 dy_b = -(dy_a) s_hit[no2].set_data :hy ,2 else s_hit[no2].set_data :hy ,1 end s_hit[no2].set_data :py ,py_b s_hit[no2].set_data :dy, dy_b when 2 #壁 px_a = s_hit[no1].get_data :px py_a = s_hit[no1].get_data :py dx_a = s_hit[no1].get_data :dx dy_a = s_hit[no1].get_data :dy hx_a = s_hit[no1].get_data :hx hy_a = s_hit[no1].get_data :hy r_a = s_hit[no1].get_data :r px_b = s_hit[no2].get_data :px py_b = s_hit[no2].get_data :py no_b = s_hit[no2].get_data :no case no_b when 51 px_a = Lb + r_a dx_a = dx_a * E if dx_a < (G * 0.05) #&& hx_a == 1 dx_a = 0 end s_hit[no1].set_data :px, px_a s_hit[no1].set_data :dx, dx_a s_hit[no1].set_data :hx, 1 when 52 px_a = 800 - Lb - r_a #(r_a * 2) dx_a = dx_a * E if dx_a < (G * 0.05) #&& hx_a == 2 dx_a = 0 end s_hit[no1].set_data :px, px_a s_hit[no1].set_data :dx, dx_a s_hit[no1].set_data :hx, 2 when 53 if px_a < Ll px_a = Ll - r_a hx = 2 else px_a = Ll + Lb + r_a hx = 1 end dx_a = dx_a * E if dx_a < (G * 0.05) #&& hx_a == 1 dx_a = 0 end s_hit[no1].set_data :px, px_a s_hit[no1].set_data :dx, dx_a s_hit[no1].set_data :hx, hx when 54 dx_a = dx_a * M if dx_a < (G * 0.05) #&& hx_a == 1 dx_a = 0 end dy_a = dy_a * E if dy_a < (G * 0.05) && hy_a == 1 dy_a = 0 #end py_a = Ld - r_a - 1 #(r_a * 2) s_hit[i].set_data :hy, 0 end s_hit[no1].set_data :py, py_a s_hit[no1].set_data :dx, dx_a s_hit[no1].set_data :dy, dy_a s_hit[no1].set_data :hy, 2 end end end end #壁 s_hit[51] = scene.add :image, :name => :nm_s_hit, :template => :tmp_hit, :position => [0, 0], :z_order => 5 s_hit[51].copy_rect 1, 1 s_hit[51].collision :rect, :mode => :left_top, :position => [0, 0], :width => [Lb, 450], :group_id => 51 s_hit[51].set_data :no, 51 s_hit[51].set_data :px, 0 s_hit[51].set_data :py, 0 s_hit[51].set_data :type, 2 s_hit[52] = scene.add :image, :name => :nm_s_hit, :template => :tmp_hit, :position => [(800 - Lb), 0], :z_order => 5 s_hit[52].copy_rect 1, 1 s_hit[52].collision :rect, :mode => :left_top, :position => [0, 0], :width => [Lb, 450], :group_id => 52 s_hit[52].set_data :no, 52 s_hit[52].set_data :px, (800 - Lb) s_hit[52].set_data :py, 0 s_hit[52].set_data :type, 2 s_hit[53] = scene.add :image, :name => :nm_s_hit, :template => :tmp_hit, :position => [Ll, (450 - Lh)], :z_order => 5 s_hit[53].copy_rect 1, 1 s_hit[53].collision :rect, :mode => :left_top, :position => [0, 0], :width => [Lb, Lh], :group_id => 53 s_hit[53].set_data :no, 53 s_hit[53].set_data :px, Ll s_hit[53].set_data :py, (450 - Lh) s_hit[53].set_data :type, 2 s_hit[54] = scene.add :image, :name => :nm_s_hit, :template => :tmp_hit, :position => [(Ll + Lb), Ld], :z_order => 5 s_hit[54].copy_rect 1, 1 s_hit[54].collision :rect, :mode => :left_top, :position => [0, 0], :width => [(800 - Ll - Lb * 2), Lb], :group_id => 54 s_hit[54].set_data :no, 54 s_hit[54].set_data :px, (Ll + Lb) s_hit[54].set_data :py, Ld s_hit[54].set_data :type, 2 s_hit[55] = scene.add :image, :name => :nm_s_hit, :template => :tmp_hit, :position => [85 + Cx, 0 + Cy], :center_offset => [0,0], :z_order => 5, :rotation => 0 #Math::PI / 4 s_hit[55].copy_rect 1, 1 s_hit[55].collision :rect, :mode => :left_top, :position => [0, 0], :width => [2, Clen], :group_id => 55 s_hit[55].set_data :no, 55 s_hit[55].set_data :px, 85 + Cx s_hit[55].set_data :py, 0 + Cy s_hit[55].set_data :type, 0 s_hit[55].set_data :hit, 0 s_hit[56] = scene.add :image, :name => :nm_s_hit, :template => :tmp_hit, :position => [0 + Cx, 1 + Cy], :center_offset => [0,1], :z_order => 5, :rotation => 0 #-(Math::PI / 4) s_hit[56].copy_rect 1, 1 s_hit[56].collision :rect, :mode => :left_top, :position => [0, 0], :width => [2, Clen], :group_id => 56 s_hit[56].set_data :no, 56 s_hit[56].set_data :px, 0 + Cx s_hit[56].set_data :py, 0 + Cy s_hit[56].set_data :type, 0 s_hit[56].set_data :hit, 0 #_/_/_/_/_/ 表示用 _/_/_/_/_/ s_add = 0 #背景 s_base_01 = scene.add :image, :template => :tmp_base, :position => [0, 0], :z_order => 0 s_base_01.copy_rect 0, 1 s_base_01.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #前景 s_base_02 = scene.add :image, :template => :tmp_base, :position => [0, 0], :z_order => 5 s_base_02.copy_rect 0, 0 s_base_02.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #ボタン spx = 320 spy = 347 s_obj_01 = scene.add :image, :template => :tmp_obj_01, :position => [spx, spy], :z_order => 6 s_obj_01.copy_rect 4, 0 s_obj_01.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #クレーン本体 spx = (Cx - 34) spy = (Cy - 530) s_obj_02 = scene.add :image, :template => :tmp_obj_02, :position => [spx, spy], :z_order => 2 s_obj_02.copy_rect 4, 0 s_obj_02.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #クレーンアーム spx = ((s_hit[56].get_data :px) - 9) spy = ((s_hit[56].get_data :py)) s_obj_03_1 = scene.add :image, :template => :tmp_obj_03, :position => [spx, spy], :center_offset => [10,4], :z_order => 3 s_obj_03_1.copy_rect 33, 12 s_obj_03_1.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 s_obj_03_2 = scene.add :image, :template => :tmp_obj_03, :position => [74 + spx, spy], :center_offset => [20,4], :z_order => 2 s_obj_03_2.copy_rect 36, 12 s_obj_03_2.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #タイマー s_obj_04 = [] spx = 132 spy = 362 (0...10).each do |i| s_obj_04[i] = scene.add :image, :template => :tmp_obj_04, :position => [spx + i * 15, spy], :z_order => 6 s_obj_04[i].copy_rect 51, 13 s_obj_04[i].set_color 0, 196, 255, 255 s_obj_04[i].collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 end #景品 s_char = [] s_char_d = [] (0...50).each do |i| if (i < 5) || (i > 24 && i < 28) && (i > 39 && i < 42) #i < 10 no = rand_max - (rand(5) + 1) else no = rand(rand_max) end if i < 25 rs = 0.8 elsif i < 40 rs = 0.9 else rs = 1 end s_char[i] = scene.add :image, :template => :tmp_char, :position => [(-100), (-100)], :z_order => 4 s_char[i].copy_rect (no % 10), ((no / 10).to_i) s_char[i].set_scale rs, rs #0.8 + ((i / 20).to_i) * 0.1, 0.8 + ((i / 20).to_i) * 0.1 s_char[i].collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 s_char[i].set_data :no, i s_char[i].set_data :ty, no s_char[i].set_data :co, 0 s_char[i].set_data :xn, (-100) s_char[i].set_data :yn, (-100) s_char[i].set_data :x1, (-100) s_char[i].set_data :y1, (-100) s_char[i].set_data :x2, (-100) s_char[i].set_data :y2, (-100) s_char[i].set_data :x3, (-100) s_char[i].set_data :y3, (-100) s_char[i].set_data :x4, (-100) s_char[i].set_data :y4, (-100) s_char[i].set_data :x5, (-100) s_char[i].set_data :y5, (-100) s_char[i].set_data :x6, (-100) s_char[i].set_data :y6, (-100) s_char[i].set_data :x7, (-100) s_char[i].set_data :y7, (-100) s_char[i].set_data :x8, (-100) s_char[i].set_data :y8, (-100) s_char[i].set_data :x9, (-100) s_char[i].set_data :y9, (-100) s_char[i].set_data :x0, (-100) s_char[i].set_data :y0, (-100) s_char_d[i] = scene.add :image, :template => :tmp_char, :position => [(-100), (-100)], :z_order => 8 s_char_d[i].copy_rect (no % 10), ((no / 10).to_i) s_char_d[i].set_scale rs, rs #0.8 + ((i / 20).to_i) * 0.1, 0.8 + ((i / 20).to_i) * 0.1 s_char_d[i].collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 end s_char_n = [(-1),(-1),(-1),(-1),(-1),(-1),(-1),(-1),(-1),(-1)] #リザルト枠 spx = 810 #(32 * 1) spy = 460 #(32 * 2 + 16) s_str_01 = scene.add :image, :template => :tmp_str_01, :position => [spx, spy], :z_order => 6 s_str_01.copy_rect 0, 0 s_str_01.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #spx = 810 #(32 * 8 + 16) #spy = 460 #(32 * 1) s_str_02 = scene.add :image, :template => :tmp_str_02, :position => [spx, spy], :z_order => 7 s_str_02.copy_rect 1, 3 s_str_02.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #spx = 810 #(32 * 10) #spy = 460 #(32 * 1 + 16) s_str_03 = scene.add :image, :template => :tmp_str_03, :position => [spx, spy], :z_order => 8 s_str_03.copy_rect 3, 6 s_str_03.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #spx = 810 #(32 * 11) #spy = 460 #(32 * 10) s_str_04 = scene.add :image, :template => :tmp_str_04, :position => [spx, spy], :z_order => 8 s_str_04.copy_rect 5, 8 s_str_04.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 #spx = 810 #spy = 460 s_str_05 = scene.add :image, :template => :tmp_str_04, :position => [spx, spy], :z_order => 8 s_str_05.copy_rect 4, 8 s_str_05.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 s_str_06 = scene.add :image, :template => :tmp_str_05, :position => [spx, spy], :z_order => 8 s_str_06.copy_rect 10, 8 s_str_06.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 s_str_07 = scene.add :image, :template => :tmp_str_05, :position => [spx, spy], :z_order => 8 s_str_07.copy_rect 0, 8 s_str_07.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 s_str_08 = scene.add :image, :template => :tmp_str_05, :position => [spx, spy], :z_order => 8 s_str_08.copy_rect 0, 8 s_str_08.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 s_str_09 = scene.add :image, :template => :tmp_str_05, :position => [spx, spy], :z_order => 8 s_str_09.copy_rect 11, 8 s_str_09.collision :rect, :mode => :left_top, :position => [810, 460 + s_add], :width => [0, 0], :group_id => 100 s_add += 1 load_end = true scene.event :game_count, :on_step do if load_end #if local_data[:wait_count] < 50 newtime = Time.now t = (newtime - oldtime) #* 1000 oldtime = newtime wrkG1 = G * t wrkG2 = (G * t * t) / 2 newtime_v = Time.now t_v = (newtime_v.to_f - oldtime_v.to_f) if t_v > flame_min v_flg = true oldtime_v = newtime_v end #(0...50).each do |i| (0...Kma).each do |j| i = s_char_n[j] if i > (-1) hx = s_hit[i].get_data :hx hy = s_hit[i].get_data :hy px = s_hit[i].get_data :px py = s_hit[i].get_data :py r = s_hit[i].get_data :r if hx < 3 v = 0 dx = s_hit[i].get_data :dx case hx when 1 v = dx px += v * t when 2 v = dx px -= v * t end s_hit[i].set_data :px, px end if hy < 3 v = 0 dy = s_hit[i].get_data :dy case hy when 1 v = dy + wrkG1 py = py + dy * t + wrkG2 when 2 v = dy - wrkG1 py = py - dy * t - wrkG2 end #最高点 if v < 0.1 && hy == 2 s_hit[i].set_data :hy, 1 end #すり抜け防止 if py > (Ld - (r / 2).to_i) && px > (Ll - 10) py = (Ld - (r / 2).to_i) end if py > 600 && hy == 1 px = -(600) py = s_get_count * 100 s_hit[i].set_data :hx, 5 s_hit[i].set_data :hy, 5 s_hit[i].set_data :px, px #(0...5).each do |j| # if s_char_n[j] == i s_char_n[j] = (-1) # break # end #end Kco -= 1 s_get_count += 1 end s_hit[i].set_data :dy, v s_hit[i].set_data :py, py end s_hit[i].set_position px, py if hy < 3 && (v_flg || py < (Ld - 100)) cx = s_char[i].get_data :xn cy = s_char[i].get_data :yn px -= (r * 1.3) py -= (r * 1.3) if ((cx - Kkan) > px) || ((cx + Kkan) < px) || ((cy - Kkan) > py) || ((cy + Kkan) < py) || ((Ld - (r * 5)) > py) #((Ld - (r * 2.5)) > py) cx = px cy = py s_char[i].set_data :co, 0 s_char[i].set_position cx, cy s_char[i].set_data :xn, cx s_char[i].set_data :yn, cy else co = s_char[i].get_data :co if co < 10 #if (co % 2) == 0 # wrk_co = co / 2 case co #wrk_co when 0 s_char[i].set_data :x1, px s_char[i].set_data :y1, py when 1 s_char[i].set_data :x2, px s_char[i].set_data :y2, py when 2 s_char[i].set_data :x3, px s_char[i].set_data :y3, py when 3 s_char[i].set_data :x4, px s_char[i].set_data :y4, py when 4 s_char[i].set_data :x5, px s_char[i].set_data :y5, py when 5 s_char[i].set_data :x6, px s_char[i].set_data :y6, py when 6 s_char[i].set_data :x7, px s_char[i].set_data :y7, py when 7 s_char[i].set_data :x8, px s_char[i].set_data :y8, py when 8 s_char[i].set_data :x9, px s_char[i].set_data :y9, py when 9 s_char[i].set_data :x0, px s_char[i].set_data :y0, py end #end co += 1 s_char[i].set_data :co, co else wrk_x = s_char[i].get_data :x1 wrk_x += s_char[i].get_data :x2 wrk_x += s_char[i].get_data :x3 wrk_x += s_char[i].get_data :x4 wrk_x += s_char[i].get_data :x5 wrk_x += s_char[i].get_data :x6 wrk_x += s_char[i].get_data :x7 wrk_x += s_char[i].get_data :x8 wrk_x += s_char[i].get_data :x9 wrk_x += s_char[i].get_data :x0 wrk_x /= 10 wrk_y = s_char[i].get_data :y1 wrk_y += s_char[i].get_data :y2 wrk_y += s_char[i].get_data :y3 wrk_y += s_char[i].get_data :y4 wrk_y += s_char[i].get_data :y5 wrk_y += s_char[i].get_data :y6 wrk_y += s_char[i].get_data :y7 wrk_y += s_char[i].get_data :y8 wrk_y += s_char[i].get_data :y9 wrk_y += s_char[i].get_data :y0 wrk_y /= 10 cx = wrk_x cy = wrk_y s_char[i].set_data :co, 0 s_char[i].set_position cx, cy s_char[i].set_data :xn, cx s_char[i].set_data :yn, cy end end end end end v_flg = false case Cm when 0 when 1 px1 = s_hit[55].get_data :px py1 = s_hit[55].get_data :py if px1 < (800 - 35) px1 += Cspd1 s_hit[55].set_data :px, px1 px2 = s_hit[56].get_data :px py2 = s_hit[56].get_data :py px2 += Cspd1 s_hit[56].set_data :px, px2 s_hit[55].set_position px1, py1 s_hit[56].set_position px2, py2 spx = (px2 - 34) spy = (py2 - 530) s_obj_02.set_position spx, spy spx = (px2 - 9) spy = py2 s_obj_03_1.set_position spx, spy s_obj_03_2.set_position (spx + 75), spy end when 7 Ca += 1 if Ca > Wait1 Ca = 0 Cm = 2 end when 2 px1 = s_hit[55].get_data :px py1 = s_hit[55].get_data :py if py1 < (Ld - 35) py1 += Cspd2 s_hit[55].set_data :py, py1 px2 = s_hit[56].get_data :px py2 = s_hit[56].get_data :py py2 += Cspd2 s_hit[56].set_data :py, py2 s_hit[55].set_position px1, py1 s_hit[56].set_position px2, py2 spx = (px2 - 34) spy = (py2 - 530) s_obj_02.set_position spx, spy spx = (px2 - 9) spy = py2 s_obj_03_1.set_position spx, spy s_obj_03_2.set_position (spx + 74), spy else Ca += 1 if Ca > Wait2 Ca = 0 Cm = 3 s_hit[55].set_data :hit, 0 s_hit[56].set_data :hit, 0 end end when 3 if (s_hit[55].get_rotation < ((Math::PI / 4) - ((s_hit[55].get_data :hit) / 12).to_i)) || (s_hit[55].get_rotation < (Math::PI / 6)) s_hit[55].set_rotation s_hit[55].get_rotation + KaiS s_hit[56].set_rotation s_hit[56].get_rotation - KaiS s_obj_03_1.set_rotation s_obj_03_1.get_rotation - KaiS s_obj_03_2.set_rotation s_obj_03_2.get_rotation + KaiS else Ca += 1 if Ca > Wait2 Ca = 0 Cm = 4 end end when 4 px1 = s_hit[55].get_data :px py1 = s_hit[55].get_data :py if py1 > Cy py1 -= Cspd2 s_hit[55].set_data :py, py1 px2 = s_hit[56].get_data :px py2 = s_hit[56].get_data :py py2 -= Cspd2 s_hit[56].set_data :py, py2 s_hit[55].set_position px1, py1 s_hit[56].set_position px2, py2 spx = (px2 - 34) spy = (py2 - 530) s_obj_02.set_position spx, spy spx = (px2 - 9) spy = py2 s_obj_03_1.set_position spx, spy s_obj_03_2.set_position (spx + 74), spy else Ca += 1 if Ca > Wait1 Ca = 0 Cm = 5 end end when 5 px1 = s_hit[55].get_data :px py1 = s_hit[55].get_data :py if px1 > (Cx + 85) px1 -= Cspd1 s_hit[55].set_data :px, px1 px2 = s_hit[56].get_data :px py2 = s_hit[56].get_data :py px2 -= Cspd1 s_hit[56].set_data :px, px2 s_hit[55].set_position px1, py1 s_hit[56].set_position px2, py2 spx = (px2 - 34) spy = (py2 - 530) s_obj_02.set_position spx, spy spx = (px2 - 9) spy = py2 s_obj_03_1.set_position spx, spy s_obj_03_2.set_position (spx + 74), spy else Ca += 1 if Ca > Wait1 Ca = 0 Cm = 6 end end when 6 if s_hit[55].get_rotation > 0 s_hit[55].set_rotation s_hit[55].get_rotation - KaiS s_hit[56].set_rotation s_hit[56].get_rotation + KaiS s_obj_03_1.set_rotation s_obj_03_1.get_rotation + KaiS s_obj_03_2.set_rotation s_obj_03_2.get_rotation - KaiS else Cm = 0 end end if (Kco < Kma) && (Kwan == Kwam) #追加 if s_hit_count < 50 no = rand(50) while s_set[no] no = rand(50) end wrk = rand((800 - (Ll + 250))) + Ll + 150 #if s_hit_count < 20 # wrk = 0 #end s_hit[no].set_data :px, wrk s_hit[no].set_data :py, (-100) s_hit[no].set_data :dx, 0 s_hit[no].set_data :dy, 0 s_hit[no].set_data :hx, 0 s_hit[no].set_data :hy, 1 s_set[no] = true (0...Kma).each do |j| if s_char_n[j] < 0 s_char_n[j] = no break end end s_hit_count += 1 end Kwan = 0 Kco += 1 end if (Kwan < Kwam) Kwan += 1 end #タイマー gametime_now = Time.now if (gametime_co < 10) if ((gametime_now - gametime).to_i > (gametime_max / 10)) s_obj_04[(9 - gametime_co)].set_position 810, 410 if gametime_co == 4 (0...10).each do |i| s_obj_04[i].set_color 255, 196, 0, 255 end Kma = 6 end if gametime_co == 7 (0...10).each do |i| s_obj_04[i].set_color 250, 45, 90, 255 end Kma = 8 end gametime_co += 1 gametime = gametime_now end else #リザルト if Cm == 0 case gametime_res when 0 gametime = gametime_now gametime_res += 1 when 1 if (gametime_now - gametime).to_i > gametime_loss spx = (32 * 1) spy = (32 * 2 + 16) s_str_01.set_position spx, spy spx = (32 * 8 + 16) spy = (32 * 1) s_str_02.set_position spx, spy spx = (32 * 10) spy = (32 * 1 + 16) s_str_03.set_position spx, spy spx = (32 * 20) spy = (32 * 9) s_str_05.set_position spx, spy spx = (32 * 15) #spy = (32 * 9) s_str_06.set_position spx, spy spx = (32 * 18) #spy = (32 * 9) s_str_08.set_position spx, spy spx = (32 * 19) #spy = (32 * 9) s_str_09.set_position spx, spy gametime = gametime_now gametime_res += 1 end when 2 if Rco < s_get_count if (gametime_now - gametime).to_f > 0.5 if Rco == 9 spx = (32 * 17) spy = (32 * 9) s_str_07.set_position spx, spy end if (Rco % 7 == 0) && (Rco > 10) (0...7).each do |i| no = Rshli[(Rcop * 7 + i)] spx = 810 spy = 460 s_char_d[no].set_position spx, spy no = Rshli[((Rcop + 1) * 7 + i)] r = s_hit[no].get_data :r spx = (96 * i) + (32 * 2) + ((36 - r) / 3).to_i * 4.8 spy = (32 * 3 + 16) + ((36 - r) / 3).to_i * 4.8 s_char_d[no].set_position spx, spy end Rcop += 1 end (Rsh...50).each do |i| hy = s_hit[i].get_data :hy r = s_hit[i].get_data :r if hy > 4 spx = (96 * (Rco % 7)) + (32 * 2) + ((36 - r) / 3).to_i * 4.8 if Rco < 7 spy = (32 * 3 + 16) + ((36 - r) / 3).to_i * 4.8 else spy = 96 + (32 * 3 + 16) + ((36 - r) / 3).to_i * 4.8 end s_char_d[i].set_position spx, spy #s_char_d[i].z_order 8 Rshli[Rco] = i no = s_char[i].get_data :ty no2 = ((39 - r) / 3).to_i #view_sp.set_text "#{no} #{no2}" wrk = local_data[:get_item][no][no2] wrk += 1 local_data[:get_item][no][no2] = wrk if local_data[:get_item][no][0] == 0 && local_data[:get_item][no][1] > 0 && local_data[:get_item][no][2] > 0 && local_data[:get_item][no][3] > 0 local_data[:get_item][no][0] = 1 wrk = local_data[:max_char] wrk += 1 local_data[:max_char] = wrk end Rsh = (i + 1) break #i = 50 end end Rco += 1 s_str_07.copy_rect (Rco / 10).to_i, 8 s_str_08.copy_rect (Rco % 10), 8 gametime = gametime_now end else spx = (32 * 11) spy = (32 * 10) s_str_04.set_position spx, spy if local_data[:high_score] < s_get_count local_data[:high_score] = s_get_count end gametime_res += 1 end end end end local_data[:wait_count] += 1 #else # local_data[:wait_count] = 0 # if local_data[:s_hit_pos][0] > 650 || local_data[:s_hit_pos][0] < 100 # hx = !(hx) # #local_data[:s_hit_pos][0] = 0 # end #end #view_sp.set_text "#{s_char_n}" #view_sp.set_text "#{s_hit_count} #{s_get_count} \n #{Kco} #{gametime_co}" end end end end #シーン コレクション scene :scene_colect do |scene| 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 load_end = false local_data[:wait_count] = 0 Cstep = 0 Cspd1 = 4 Tyd = (-50) Ty = (-50) select_mode = 0 select_mode_old = 0 play_count = local_data[:play_count] if play_count > 9999 play_count = 9999 end high_score = local_data[:high_score] if high_score > 9999 high_score = 9999 end #viewCount = false #最大種類 rand_max = sys_max_data if local_data[:max_char] < rand_max rand_max = local_data[:max_char] end page_max = ((rand_max / 2) + 0.5).to_i - 2 get_flg = [] get_count = [] zisyo_flg = [] (0...500).each do |i| get_flg[i] = [] get_count[i] = [] if local_data[:get_item][i][1] < 1 get_flg[i][1] = 1 else get_flg[i][1] = 0 end get_count[i][0] = local_data[:get_item][i][1] if get_count[i][0] > 9999 get_count[i][0] = 9999 end if local_data[:get_item][i][2] < 1 get_flg[i][2] = 1 else get_flg[i][2] = 0 end get_count[i][1] = local_data[:get_item][i][2] if get_count[i][1] > 9999 get_count[i][1] = 9999 end if local_data[:get_item][i][3] < 1 get_flg[i][3] = 1 else get_flg[i][3] = 0 end get_count[i][2] = local_data[:get_item][i][3] if get_count[i][2] > 9999 get_count[i][2] = 9999 end if (get_flg[i][1] == 1 && get_flg[i][2] == 1 && get_flg[i][3] == 1) get_flg[i][0] = 1 else get_flg[i][0] = 0 end zisyo_count = 4 if (get_count[i][0] > zisyo_count && get_count[i][1] > zisyo_count && get_count[i][2] > zisyo_count) zisyo_flg[i] = 0 else zisyo_flg[i] = 1 end end scene.on_init do s_dummy = scene.add :image, :name => :game_count, :template => :tmp_char, :position => [(-100), (-100)], :z_order => 0 s_dummy.copy_rect 0, 0 #ボタン s_btn = scene.add :image, :name => :nm_s_btn0, :template => :tmp_hit, :position => [395, 395], :z_order => 5 s_btn.copy_rect 1, 1 s_btn.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 s_btn1 = scene.add :image, :name => :nm_s_btn, :template => :tmp_hit, :position => [725, 395], :z_order => 5 s_btn1.copy_rect 1, 1 s_btn1.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 s_btn2 = scene.add :image, :name => :nm_s_btn1, :template => :tmp_hit, :position => [560, 395], :z_order => 5 s_btn2.copy_rect 1, 1 s_btn2.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 #s_btn3 = scene.add :image, :name => :nm_s_btn2, :template => :tmp_hit, :position => [725, 0], :z_order => 5 #s_btn3.copy_rect 1, 1 #s_btn3.collision :circle, :mode => :center, :position => [0, 0], :radius => 75, :group_id => 0 #辞書ベース s_zisyo_01 = scene.add :image, :template => :tmp_zisyo, :position => [810, 460], :z_order => 4 s_zisyo_01.copy_rect 0, 0 s_zisyo_01.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #辞書データ s_zisyo_02 = scene.add :image, :template => :tmp_data_a, :position => [810, 460], :z_order => 4 s_zisyo_02.copy_rect 0, 0 s_zisyo_02.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 s_zisyo_03 = scene.add :image, :template => :tmp_data_b, :position => [810, 460], :z_order => 4 s_zisyo_03.copy_rect 0, 0 s_zisyo_03.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 scene.event :nm_s_btn0, :on_touch_up do #タイトルへ scene_change :scene_title end scene.event :nm_s_btn, :on_touch_up do #下 if select_mode < page_max select_mode += 1 #Cstep = 1 s_zisyo_01.set_position 810, 460 s_zisyo_02.set_position 810, 460 s_zisyo_03.set_position 810, 460 end end scene.event :nm_s_btn1, :on_touch_up do #上 if select_mode > 0 select_mode -= 1 #Cstep = 2 s_zisyo_01.set_position 810, 460 s_zisyo_02.set_position 810, 460 s_zisyo_03.set_position 810, 460 end end #scene.event :nm_s_btn2, :on_touch_up do # viewCount = !(viewCount) # if viewCount # # else # # end #end #背景 s_base_01 = scene.add :image, :template => :tmp_colect, :position => [0, 0], :z_order => 0 s_base_01.copy_rect 0, 0 s_base_01.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #前景 s_base_02 = scene.add :image, :template => :tmp_colect, :position => [0, 0], :z_order => 5 s_base_02.copy_rect 0, 1 s_base_02.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #ボタン s_obj_01 = scene.add :image, :template => :tmp_tana, :position => [315, 365], :z_order => 6 s_obj_01.copy_rect 0, 10 s_obj_01.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #棚 s_tana = [] (0...4).each do |i| s_tana[i] = scene.add :image, :template => :tmp_tana, :position => [0, (Ty + 180 * i)], :z_order => 1 s_tana[i].copy_rect 0, 9 s_tana[i].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 end s_name = [] s_item = [] s_item_s = [] s_kostr = [] s_zisyo = [] nm_s_zisyo = [] (0...8).each do |i| no = (i - 2) if no < 0 s_name[i] = scene.add :image, :template => :tmp_name, :position => [(38 + 404 * (i % 2)), (Ty + 21 + 180 * (i / 2).to_i)], :z_order => 1 s_name[i].copy_rect 0, 0 else s_name[i] = scene.add :image, :template => :tmp_name, :position => [((38 + 404 * (i % 2)) + (get_flg[no][0] * 800)), (Ty + 21 + 180 * (i / 2).to_i)], :z_order => 1 s_name[i].copy_rect (no % 5), (no / 5).to_i end s_name[i].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 if no < 0 s_zisyo[i] = scene.add :image, :template => :tmp_zisyo_b, :position => [(348 + 404 * (i % 2)), (Ty - 110 + 180 * (i / 2).to_i)], :z_order => 1 s_zisyo[i].copy_rect 13, 2 else s_zisyo[i] = scene.add :image, :template => :tmp_zisyo_b, :position => [((348 + 404 * (i % 2)) + (zisyo_flg[no] * 800)), (Ty - 110 + 180 * (i / 2).to_i)], :z_order => 1 s_zisyo[i].copy_rect 13, 0 end s_zisyo[i].collision :rect, :mode => :left_top, :position => [(-10), (-10)], :width => [52, 68], :group_id => 100 s_zisyo[i].set_data :no, i s_zisyo[i].set_data :Ty, Ty s_zisyo[i].set_data :i_no, i - 2 s_zisyo[i].event :on_touch_up do |event| no = event.target.get_data :no Ty = event.target.get_data :Ty i_no = event.target.get_data :i_no #if s_zisyo_01.get_position[0] > 400 case no when 2 s_zisyo_01.set_position 400, (Ty + 66) if i_no < 50 s_zisyo_02.set_position 400, (Ty + 66) s_zisyo_02.copy_rect (i_no % 5), (i_no / 5).to_i elsif i_no < 100 s_zisyo_03.set_position 400, (Ty + 66) s_zisyo_03.copy_rect ((i_no - 50) % 5), ((i_no - 50) / 5).to_i end when 3 s_zisyo_01.set_position 0, (Ty + 66) if i_no < 50 s_zisyo_02.set_position 0, (Ty + 66) s_zisyo_02.copy_rect (i_no % 5), (i_no / 5).to_i elsif i_no < 100 s_zisyo_03.set_position 0, (Ty + 66) s_zisyo_03.copy_rect ((i_no - 50) % 5), ((i_no - 50) / 5).to_i end when 4 s_zisyo_01.set_position 400, (Ty + 246) if i_no < 50 s_zisyo_02.set_position 400, (Ty + 246) s_zisyo_02.copy_rect (i_no % 5), (i_no / 5).to_i elsif i_no < 100 s_zisyo_03.set_position 400, (Ty + 246) s_zisyo_03.copy_rect ((i_no - 50) % 5), ((i_no - 50) / 5).to_i end when 5 s_zisyo_01.set_position 0, (Ty + 246) if i_no < 50 s_zisyo_02.set_position 0, (Ty + 246) s_zisyo_02.copy_rect (i_no % 5), (i_no / 5).to_i elsif i_no < 100 s_zisyo_03.set_position 0, (Ty + 246) s_zisyo_03.copy_rect ((i_no - 50) % 5), ((i_no - 50) / 5).to_i end end #else # s_zisyo_01.set_position 810, 410 # s_zisyo_02.set_position 810, 410 #end end s_item[i] = [] s_item_s[i] = [] s_kostr[i] = [] (0...3).each do |j| wrk_x = (43 + 404 * (i % 2) + j * 109) wrk_y = (Ty - 80 + 180 * (i / 2).to_i) + j * 9 if no < 0 s_item[i][j] = scene.add :image, :template => :tmp_char, :position => [wrk_x, wrk_y], :z_order => 3 s_item[i][j].copy_rect 0, 0 s_item_s[i][j] = scene.add :image, :template => :tmp_char, :position => [wrk_x - 3 + ((i % 2) * 6), wrk_y], :z_order => 2 s_item_s[i][j].copy_rect 0, 0 else s_item[i][j] = scene.add :image, :template => :tmp_char, :position => [wrk_x + (get_flg[no][(j + 1)] * 800), wrk_y], :z_order => 3 s_item[i][j].copy_rect (no % 10), (no / 10).to_i s_item_s[i][j] = scene.add :image, :template => :tmp_char, :position => [wrk_x - 3 + ((i % 2) * 6) + (get_flg[no][(j + 1)] * 800), wrk_y], :z_order => 2 s_item_s[i][j].copy_rect (no % 10), (no / 10).to_i end s_item[i][j].set_scale 1 - (j * 0.1), 1 - (j * 0.1) s_item[i][j].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 s_item_s[i][j].set_color 0, 0, 0, 64 s_item_s[i][j].set_scale 1 - (j * 0.1), 1 - (j * 0.1) s_item_s[i][j].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #個数 s_kostr[i][j] = [] s_kostr[i][j][0] = scene.add :image, :template => :tmp_str_05_s, :position => [wrk_x + ((2 - j) * 4), (wrk_y - 24)], :z_order => 3 if no < 0 s_kostr[i][j][0].copy_rect 20, 12 else if get_count[no][j] > 999 s_kostr[i][j][0].copy_rect (((get_count[no][j] / 1000) % 10).to_i), 8 else s_kostr[i][j][0].copy_rect 20, 12 end end s_kostr[i][j][0].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 s_kostr[i][j][1] = scene.add :image, :template => :tmp_str_05_s, :position => [wrk_x + 16 + ((2 - j) * 4), (wrk_y - 24)], :z_order => 3 if no < 0 s_kostr[i][j][1].copy_rect 20, 12 else if get_count[no][j] > 99 s_kostr[i][j][1].copy_rect (((get_count[no][j] / 100) % 10).to_i), 8 else s_kostr[i][j][1].copy_rect 20, 12 end end s_kostr[i][j][1].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 s_kostr[i][j][2] = scene.add :image, :template => :tmp_str_05_s, :position => [wrk_x + (16 * 2) + ((2 - j) * 4), (wrk_y - 24)], :z_order => 3 if no < 0 s_kostr[i][j][2].copy_rect 20, 12 else if get_count[no][j] > 9 s_kostr[i][j][2].copy_rect (((get_count[no][j] / 10) % 10).to_i), 8 else s_kostr[i][j][2].copy_rect 20, 12 end end s_kostr[i][j][2].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 s_kostr[i][j][3] = scene.add :image, :template => :tmp_str_05_s, :position => [wrk_x + (16 * 3) + ((2 - j) * 4), (wrk_y - 24)], :z_order => 3 if no < 0 s_kostr[i][j][3].copy_rect 0, 8 else if get_count[no][j] > 0 s_kostr[i][j][3].copy_rect ((get_count[no][j] % 10).to_i), 8 else s_kostr[i][j][3].copy_rect 20, 12 end end s_kostr[i][j][3].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 s_kostr[i][j][4] = scene.add :image, :template => :tmp_str_05_s, :position => [wrk_x + (16 * 4) + ((2 - j) * 4), (wrk_y - 24)], :z_order => 3 if no < 0 s_kostr[i][j][4].copy_rect 0, 8 else if get_count[no][j] > 0 s_kostr[i][j][4].copy_rect 11, 8 else s_kostr[i][j][4].copy_rect 20, 12 end end s_kostr[i][j][4].collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 end end #プレイ回数 px = 145 py = 374 if play_count > 999 s_pc_0 = scene.add :image, :template => :tmp_str_05, :position => [px, py], :z_order => 5 s_pc_0.copy_rect (((play_count / 1000) % 10).to_i), 8 s_pc_0.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 end if play_count > 99 s_pc_1 = scene.add :image, :template => :tmp_str_05, :position => [(px + 32), py], :z_order => 5 s_pc_1.copy_rect (((play_count / 100) % 10).to_i), 8 s_pc_1.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 end if play_count > 9 s_pc_2 = scene.add :image, :template => :tmp_str_05, :position => [(px + 32 * 2), py], :z_order => 5 s_pc_2.copy_rect (((play_count / 10) % 10).to_i), 8 s_pc_2.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 end s_pc_3 = scene.add :image, :template => :tmp_str_05, :position => [(px + 32 * 3), py], :z_order => 5 if play_count > 0 s_pc_3.copy_rect ((play_count % 10).to_i), 8 else s_pc_3.copy_rect 0, 8 end s_pc_3.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 #ハイスコア py = 411 if high_score > 999 s_hs_0 = scene.add :image, :template => :tmp_str_05, :position => [px, py], :z_order => 5 s_hs_0.copy_rect (((high_score / 1000) % 10).to_i), 8 s_hs_0.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 end if high_score > 99 s_hs_1 = scene.add :image, :template => :tmp_str_05, :position => [(px + 32), py], :z_order => 5 s_hs_1.copy_rect (((high_score / 100) % 10).to_i), 8 s_hs_1.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 end if high_score > 9 s_hs_2 = scene.add :image, :template => :tmp_str_05, :position => [(px + 32 * 2), py], :z_order => 5 s_hs_2.copy_rect (((high_score / 10) % 10).to_i), 8 s_hs_2.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 end s_hs_3 = scene.add :image, :template => :tmp_str_05, :position => [(px + 32 * 3), py], :z_order => 5 if high_score > 0 s_hs_3.copy_rect ((high_score % 10).to_i), 8 else s_hs_3.copy_rect 0, 8 end s_hs_3.collision :rect, :mode => :left_top, :position => [810, 460], :width => [0, 0], :group_id => 100 load_end = true scene.event :game_count, :on_step do if load_end if select_mode_old < select_mode #|| Cstep == 1 Ty -= Cspd1 if (select_mode_old + 2) < select_mode Ty -= Cspd1 end if Ty < (Tyd - 180) Ty = Tyd select_mode_old += 1 if select_mode_old == select_mode Cstep = 0 end (0...8).each do |i| no = (i - 2) + select_mode_old * 2 if no < 0 s_name[i].copy_rect 0, 0 else s_name[i].copy_rect (no % 5), (no / 5).to_i end (0...3).each do |j| if no < 0 s_item[i][j].copy_rect 0, 0 s_item_s[i][j].copy_rect 0, 0 else s_item[i][j].copy_rect (no % 10), (no / 10).to_i s_item_s[i][j].copy_rect (no % 10), (no / 10).to_i end if no < 0 s_zisyo[i].copy_rect 13, 2 else s_zisyo[i].copy_rect 13, 0 end if no < 0 s_kostr[i][j][0].copy_rect 20, 12 s_kostr[i][j][1].copy_rect 20, 12 s_kostr[i][j][2].copy_rect 20, 12 s_kostr[i][j][3].copy_rect 20, 12 s_kostr[i][j][4].copy_rect 20, 12 else if get_count[no][j] > 0 if get_count[no][j] > 999 s_kostr[i][j][0].copy_rect (((get_count[no][j] / 1000) % 10).to_i), 8 else s_kostr[i][j][0].copy_rect 20, 12 end if get_count[no][j] > 99 s_kostr[i][j][1].copy_rect (((get_count[no][j] / 100) % 10).to_i), 8 else s_kostr[i][j][1].copy_rect 20, 12 end if get_count[no][j] > 9 s_kostr[i][j][2].copy_rect (((get_count[no][j] / 10) % 10).to_i), 8 else s_kostr[i][j][2].copy_rect 20, 12 end s_kostr[i][j][3].copy_rect ((get_count[no][j] % 10).to_i), 8 s_kostr[i][j][4].copy_rect 11, 8 else s_kostr[i][j][0].copy_rect 20, 12 s_kostr[i][j][1].copy_rect 20, 12 s_kostr[i][j][2].copy_rect 20, 12 s_kostr[i][j][3].copy_rect 20, 12 s_kostr[i][j][4].copy_rect 20, 12 end end end end end (0...4).each do |i| s_tana[i].set_position 0, (Ty + 180 * i) end (0...8).each do |i| no = (i - 2) + select_mode_old * 2 if no < 0 s_name[i].set_position (38 + 404 * (i % 2)), (Ty + 21 + 180 * (i / 2).to_i) else s_name[i].set_position ((38 + 404 * (i % 2)) + (get_flg[no][0] * 800)), (Ty + 21 + 180 * (i / 2).to_i) end if no < 0 s_zisyo[i].set_position (348 + 404 * (i % 2)), (Ty - 110 + 180 * (i / 2).to_i) else s_zisyo[i].set_position ((348 + 404 * (i % 2)) + (zisyo_flg[no] * 800)), (Ty - 110 + 180 * (i / 2).to_i) end s_zisyo[i].set_data :Ty, Ty #if select_mode_old == select_mode s_zisyo[i].set_data :i_no, no #end (0...3).each do |j| wrk_x = (43 + 404 * (i % 2) + j * 109) wrk_y = (Ty - 80 + 180 * (i / 2).to_i) + j * 9 if no < 0 s_item[i][j].set_position wrk_x, wrk_y s_item_s[i][j].set_position wrk_x - 3 + ((i % 2) * 6), wrk_y else s_item[i][j].set_position wrk_x + (get_flg[no][(j + 1)] * 800), wrk_y s_item_s[i][j].set_position wrk_x - 3 + ((i % 2) * 6) + (get_flg[no][(j + 1)] * 800), wrk_y end s_kostr[i][j][0].set_position wrk_x + ((2 - j) * 4), (wrk_y - 24) s_kostr[i][j][1].set_position wrk_x + 16 + ((2 - j) * 4), (wrk_y - 24) s_kostr[i][j][2].set_position wrk_x + (16 * 2) + ((2 - j) * 4), (wrk_y - 24) s_kostr[i][j][3].set_position wrk_x + (16 * 3) + ((2 - j) * 4), (wrk_y - 24) s_kostr[i][j][4].set_position wrk_x + (16 * 4) + ((2 - j) * 4), (wrk_y - 24) end end elsif select_mode_old > select_mode #|| Cstep == 2 Ty += Cspd1 if (select_mode_old - 2) > select_mode Ty += Cspd1 end if Ty > (Tyd + 180) Ty = Tyd select_mode_old -= 1 if select_mode_old == select_mode Cstep = 0 end (0...8).each do |i| no = (i - 2) + select_mode_old * 2 if no < 0 s_name[i].copy_rect 0, 0 else s_name[i].copy_rect (no % 5), (no / 5).to_i end (0...3).each do |j| if no < 0 s_item[i][j].copy_rect 0, 0 s_item_s[i][j].copy_rect 0, 0 else s_item[i][j].copy_rect (no % 10), (no / 10).to_i s_item_s[i][j].copy_rect (no % 10), (no / 10).to_i end if no < 0 s_zisyo[i].copy_rect 13, 2 else s_zisyo[i].copy_rect 13, 0 end if no < 0 s_kostr[i][j][0].copy_rect 20, 12 s_kostr[i][j][1].copy_rect 20, 12 s_kostr[i][j][2].copy_rect 20, 12 s_kostr[i][j][3].copy_rect 20, 12 s_kostr[i][j][4].copy_rect 20, 12 else if get_count[no][j] > 0 if get_count[no][j] > 999 s_kostr[i][j][0].copy_rect (((get_count[no][j] / 1000) % 10).to_i), 8 else s_kostr[i][j][0].copy_rect 20, 12 end if get_count[no][j] > 99 s_kostr[i][j][1].copy_rect (((get_count[no][j] / 100) % 10).to_i), 8 else s_kostr[i][j][1].copy_rect 20, 12 end if get_count[no][j] > 9 s_kostr[i][j][2].copy_rect (((get_count[no][j] / 10) % 10).to_i), 8 else s_kostr[i][j][2].copy_rect 20, 12 end s_kostr[i][j][3].copy_rect ((get_count[no][j] % 10).to_i), 8 s_kostr[i][j][4].copy_rect 11, 8 else s_kostr[i][j][0].copy_rect 20, 12 s_kostr[i][j][1].copy_rect 20, 12 s_kostr[i][j][2].copy_rect 20, 12 s_kostr[i][j][3].copy_rect 20, 12 s_kostr[i][j][4].copy_rect 20, 12 end end end end end (0...4).each do |i| s_tana[i].set_position 0, (Ty + 180 * i) end (0...8).each do |i| no = (i - 2) + select_mode_old * 2 if no < 0 s_name[i].set_position (38 + 404 * (i % 2)), (Ty + 21 + 180 * (i / 2).to_i) else s_name[i].set_position ((38 + 404 * (i % 2)) + (get_flg[no][0] * 800)), (Ty + 21 + 180 * (i / 2).to_i) end if no < 0 s_zisyo[i].set_position (348 + 404 * (i % 2)), (Ty - 110 + 180 * (i / 2).to_i) else s_zisyo[i].set_position ((348 + 404 * (i % 2)) + (zisyo_flg[no] * 800)), (Ty - 110 + 180 * (i / 2).to_i) end s_zisyo[i].set_data :Ty, Ty #if select_mode_old == select_mode s_zisyo[i].set_data :i_no, no #end (0...3).each do |j| wrk_x = (43 + 404 * (i % 2) + j * 109) wrk_y = (Ty - 80 + 180 * (i / 2).to_i) + j * 9 if no < 0 s_item[i][j].set_position wrk_x, wrk_y s_item_s[i][j].set_position wrk_x - 3 + ((i % 2) * 6), wrk_y else s_item[i][j].set_position wrk_x + (get_flg[no][(j + 1)] * 800), wrk_y s_item_s[i][j].set_position wrk_x - 3 + ((i % 2) * 6) + (get_flg[no][(j + 1)] * 800), wrk_y end s_kostr[i][j][0].set_position wrk_x + ((2 - j) * 4), (wrk_y - 24) s_kostr[i][j][1].set_position wrk_x + 16 + ((2 - j) * 4), (wrk_y - 24) s_kostr[i][j][2].set_position wrk_x + (16 * 2) + ((2 - j) * 4), (wrk_y - 24) s_kostr[i][j][3].set_position wrk_x + (16 * 3) + ((2 - j) * 4), (wrk_y - 24) s_kostr[i][j][4].set_position wrk_x + (16 * 4) + ((2 - j) * 4), (wrk_y - 24) end end end end end end end #シーン ゲーム終了 scene :scene_exit do |scene| scene.on_init do #speak "終了します" set_save_data #ゲーム終了 game.change_project "start_menu" end end
コード一覧
  • start.rb

コメントするには、ログインする必要があります。

コメント一覧
お知らせ

2014/03/04 ver. 0.1.39 を公開しました!
・0.1.36でWindowsで起動しない問題を修正しました
(Android版はバージョン番号のみの変更です。)

2014/03/04 ver. 0.1.36 を公開しました!
・アプリケーションアイコンを変更しました
・セーブ・ロードを繰り返すとアプリが強制終了する問題を修正しました
・他、重大なバグを修正しました

ダウンロードはこちらから。

2013/07/17 Code on Rmakeをα公開しました!