実験 450x800 公開中

RPGテンプレ実験

投稿者:とりか 投稿日時: 2013/07/26 02:46:08
RPGゲーム制作を目標にしたテンプレート実験です
閲覧: 207 評価: 20
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
あなたはまだ評価していません。
# <とりかさんのCoR-RPG> game.draw_collision_mode true # ゲームに使用する画像のローディング game.loading do |loader| loader.add :window, :system => "window" loader.add :gui_item, :system => "gui_item" loader.add :human_image, 74 loader.add :GameWindow_image, 85 loader.add :image_AU, 67 loader.add :image_AR, 68 loader.add :image_AL, 69 loader.add :image_AD, 70 loader.add :image_ET, 72 loader.add :image_BK, 73 end # ゲームの初期化 game.on_init do set_window_image :window set_gui_image :gui_item # オープニングのシーンへ scene_change :start_scene end # 大域変数 AR_Pos = [128, 800 - 128] AR_Rad = 64 AR_Col = 48 BT_Pos = [450 - 128, 800 - 160] BT_Rad = 64 MasuSize = 32 CharaMoveD = 2 CharaAnimeF = 4 Tyuusin = [392, 237] Chara_now = [6, 6] Move_status = 0 Move_Mode = 0 # オープニングシーン scene :start_scene do |scene| scene.on_init do sp = scene.add :image, :template => :human, :center_position => [18 + 32 * Chara_now[0], 18 + 32 * Chara_now[1]] aa = scene.add :image, :template => :GameWindow, :position => [0, 0] au = scene.add :image, :template => :ARROW_U, :center_position => [AR_Pos[0], AR_Pos[1] - AR_Rad] ar = scene.add :image, :template => :ARROW_R, :center_position => [AR_Pos[0] + AR_Rad, AR_Pos[1]] al = scene.add :image, :template => :ARROW_L, :center_position => [AR_Pos[0] - AR_Rad, AR_Pos[1]] ad = scene.add :image, :template => :ARROW_D, :center_position => [AR_Pos[0], AR_Pos[1] + AR_Rad] be = scene.add :image, :template => :Button_ET, :center_position => [BT_Pos[0] + BT_Rad, BT_Pos[1]] bb = scene.add :image, :template => :Button_BK, :center_position => [BT_Pos[0], BT_Pos[1] + BT_Rad] AR_SUM = scene.add :collision, :center_position => [250, 400], :scale => [500, 800] be.event :on_touch_down do |event| speak "こんにちわ!" end bb.event :on_touch_down do |event| speak "ゲームを終了します。" # ゲーム終了 game.change_project "start_menu" end au.event :on_touch_down do |event| Move_Mode = 2 end au.event :on_touch_move do |event| Move_Mode = 2 end ar.event :on_touch_down do |event| Move_Mode = 6 end ar.event :on_touch_move do |event| Move_Mode = 6 end al.event :on_touch_down do |event| Move_Mode = 4 end al.event :on_touch_move do |event| Move_Mode = 4 end ad.event :on_touch_down do |event| Move_Mode = 8 end ad.event :on_touch_move do |event| Move_Mode = 8 end AR_SUM.event :on_step do |event| if (0 < Chara_now[1] && Move_status == 0 && Move_Mode == 2) sp.change_motion :Move_up Chara_now[1] -= 1 end if (Chara_now[0] < 12 && Move_status == 0 && Move_Mode == 6) sp.change_motion :Move_right Chara_now[0] += 1 end if (0 < Chara_now[0] && Move_status == 0 && Move_Mode == 4) sp.change_motion :Move_left Chara_now[0] -= 1 end if (Chara_now[1] < 12 && Move_status == 0 && Move_Mode == 8) sp.change_motion :Move_down Chara_now[1] += 1 end end AR_SUM.event :on_touch_up do |event| Move_Mode = 0 end end end # 表示する人間のテンプレート sprite_template :human do |st| st.texture :human_image st.src_size 20, 28 st.dest_size 40, 56 st.center_offset 5, 25 st.layer_order 10 st.collision :rect, :position => [4, 24], :width => [MasuSize, MasuSize] st.animation :stop do |commands| commands.loop false commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 0] commands.wait_animation end st.animation :down do |commands| commands.loop false commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 0] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [2, 0] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [1, 0] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [0, 0] commands.wait_animation commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 0] commands.wait_animation end st.animation :up do |commands| commands.loop false commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 3] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [2, 3] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [1, 3] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [0, 3] commands.wait_animation commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 3] commands.wait_animation end st.animation :left do |commands| commands.loop false commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 1] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [2, 1] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [1, 1] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [0, 1] commands.wait_animation commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 1] commands.wait_animation end st.animation :right do |commands| commands.loop false commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 2] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [2, 2] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [1, 2] commands.wait_animation commands.copy_rect :frame => CharaAnimeF, :src => [0, 2] commands.wait_animation commands.copy_rect :frame => CharaAnimeF / 2, :src => [1, 2] commands.wait_animation end # キャラモーション st.motion :default do |commands| commands.loop false commands.proc_call do |sprite| sprite.change_animation :stop end end # Move_up st.motion :Move_up do |commands| commands.loop false commands.proc_call do |sprite| Move_status = 1 sprite.change_animation :up end commands.move_by_v 0, -MasuSize, CharaMoveD commands.wait_motion commands.proc_call do |sprite| Move_status = 0 end end # Move_down st.motion :Move_down do |commands| commands.loop false commands.proc_call do |sprite| Move_status = 1 sprite.change_animation :down end commands.move_by_v 0, MasuSize, CharaMoveD commands.wait_motion commands.proc_call do |sprite| Move_status = 0 end end # Move_right st.motion :Move_right do |commands| commands.loop false commands.proc_call do |sprite| Move_status = 1 sprite.change_animation :right end commands.move_by_v MasuSize, 0, CharaMoveD commands.wait_motion commands.proc_call do |sprite| Move_status = 0 end end # Move_left st.motion :Move_left do |commands| commands.loop false commands.proc_call do |sprite| Move_status = 1 sprite.change_animation :left end commands.move_by_v -MasuSize, 0, CharaMoveD commands.wait_motion commands.proc_call do |sprite| Move_status = 0 end end end # 表示するゲーム画面のテンプレ sprite_template :GameWindow do |st| st.texture :GameWindow_image st.src_size 450, 800 st.dest_size 450, 800 end # 入力ボタンのテンプレ sprite_template :ARROW_U do |st| st.texture :image_AU st.src_size 48, 48 st.dest_size 64, 64 st.center_offset 64 / 2, 64 / 2 st.collision :circle, :mode => :center, :position => [0, 0], :radius => AR_Col end sprite_template :ARROW_R do |st| st.texture :image_AR st.src_size 48, 48 st.dest_size 64, 64 st.center_offset 64 / 2, 64 / 2 st.collision :circle, :mode => :center, :position => [0, 0], :radius => AR_Col end sprite_template :ARROW_L do |st| st.texture :image_AL st.src_size 48, 48 st.dest_size 64, 64 st.center_offset 64 / 2, 64 / 2 st.collision :circle, :mode => :center, :position => [0, 0], :radius => AR_Col end sprite_template :ARROW_D do |st| st.texture :image_AD st.src_size 48, 48 st.dest_size 64, 64 st.center_offset 64 / 2, 64 / 2 st.collision :circle, :mode => :center, :position => [0, 0], :radius => AR_Col end sprite_template :Button_ET do |st| st.texture :image_ET st.src_size 64, 64 st.dest_size 64, 64 st.center_offset 64 / 2, 64 / 2 st.collision :circle, :mode => :center, :position => [0, 0], :radius => 32 end sprite_template :Button_BK do |st| st.texture :image_BK st.src_size 64, 64 st.dest_size 64, 64 st.center_offset 64 / 2, 64 / 2 st.collision :circle, :mode => :center, :position => [0, 0], :radius => 32 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をα公開しました!