game.draw_fps_mode true
game.loading do |loader|
loader.add :window, :system => "window"
loader.add :gui_item, :system => "gui_item"
end
game.on_init do
set_window_image :window
set_gui_image :gui_item
speak("上下左右端をタップ、クリックで上下左右\nXYABをタップ、クリックで斜め方向に『終』が移動します。")
speak("『終』をタップ、クリックで終了します。")
scene_change :start_scene
end
LOCAL_DATA_CONSTANT = {}
def local_data
LOCAL_DATA_CONSTANT
end
local_data[:tx_x] = 390
local_data[:tx_y] = 200
local_data[:Up] = false
local_data[:Down] = false
local_data[:Left] = false
local_data[:Right] = false
local_data[:Xx] = false
local_data[:Yy] = false
local_data[:Aa] = false
local_data[:Bb] = false
scene :start_scene do |scene|
text = scene.text :position => [local_data[:tx_x], local_data[:tx_y]]
text.set_text_area_size 40, 40
text.set_font_point_size 32
text.set_color 255, 255, 100, 255
text.set_text ("終")
text.event :on_click do |event|
game.change_project "start_menu"
end
select_p(scene, :h_scene)
end
scene :h_scene do |scene|
if local_data[:Xx]
local_data[:tx_y] -= 10
local_data[:tx_x] -= 10
local_data[:Xx] = false
scene_change :start_scene
elsif local_data[:Yy]
local_data[:tx_y] -= 10
local_data[:tx_x] += 10
local_data[:Yy] = false
scene_change :start_scene
elsif local_data[:Aa]
local_data[:tx_y] += 10
local_data[:tx_x] -= 10
local_data[:Aa] = false
scene_change :start_scene
elsif local_data[:Bb]
local_data[:tx_y] += 10
local_data[:tx_x] += 10
local_data[:Bb] = false
scene_change :start_scene
elsif local_data[:Up]
local_data[:tx_y] -= 10
local_data[:Up] = false
scene_change :start_scene
elsif local_data[:Down]
local_data[:tx_y] += 10
local_data[:Down] = false
scene_change :start_scene
elsif local_data[:Left]
local_data[:tx_x] -= 10
local_data[:Left] = false
scene_change :start_scene
elsif local_data[:Right]
local_data[:tx_x] += 10
local_data[:Right] = false
scene_change :start_scene
else
scene_change :start_scene
end
end
def select_p(scene, scene_name)#操作パネル
text = scene.text :position => [100, 0]
text.set_text_area_size 600, 50
text.set_font_point_size 50
text.set_text (" □□□□□↑□□□□□")
text.event :on_touch_down do |event|
if event.target
local_data[:Up] = true
scene_change scene_name
end
end
text.event :on_touch_up do |event|
if event.target
local_data[:Up] = false
scene_change scene_name
end
end
text = scene.text :position => [100, 400]
text.set_text_area_size 600, 50
text.set_font_point_size 50
text.set_text (" □□□□□↓□□□□□")
text.event :on_touch_down do |event|
if event.target
local_data[:Down] = true
scene_change scene_name
end
end
text.event :on_touch_up do |event|
if event.target
local_data[:Down] = false
scene_change scene_name
end
end
text = scene.text :position => [1, 50]
text.set_text_area_size 50, 350
text.set_font_point_size 37
text.set_text ("□\n□\n□\n□\n←\n□\n□\n□\n□")
text.event :on_touch_down do |event|
if event.target
local_data[:Left] = true
scene_change scene_name
end
end
text.event :on_touch_up do |event|
if event.target
local_data[:Left] = false
scene_change scene_name
end
end
text = scene.text :position => [750, 50]
text.set_text_area_size 50, 350
text.set_font_point_size 37
text.set_text ("□\n□\n□\n□\n→\n□\n□\n□\n□")
text.event :on_touch_down do |event|
if event.target
local_data[:Right] = true
scene_change scene_name
end
end
text.event :on_touch_up do |event|
if event.target
local_data[:Right] = false
scene_change scene_name
end
end
text = scene.text :position => [1, 0]
text.set_text_area_size 51, 51
text.set_font_point_size 50
text.set_color 100, 255, 255, 255
text.set_text ("X")
text.event :on_touch_down do |event|
if event.target
local_data[:Xx] = true
scene_change scene_name
end
end
text.event :on_touch_up do |event|
if event.target
local_data[:Xx] = false
scene_change scene_name
end
end
text = scene.text :position => [750, 0]
text.set_text_area_size 51, 51
text.set_font_point_size 50
text.set_color 255, 100, 255, 255
text.set_text ("Y")
text.event :on_touch_down do |event|
if event.target
local_data[:Yy] = true
scene_change scene_name
end
end
text.event :on_touch_up do |event|
if event.target
local_data[:Yy] = false
scene_change scene_name
end
end
text = scene.text :position => [1, 400]
text.set_text_area_size 51, 51
text.set_font_point_size 50
text.set_color 100, 255, 100, 255
text.set_text ("A")
text.event :on_touch_down do |event|
if event.target
local_data[:Aa] = true
scene_change scene_name
end
end
text.event :on_touch_up do |event|
if event.target
local_data[:Aa] = false
scene_change scene_name
end
end
text = scene.text :position => [750, 400]
text.set_text_area_size 51, 51
text.set_font_point_size 50
text.set_color 255, 100, 100, 255
text.set_text ("B")
text.event :on_touch_down do |event|
if event.target
local_data[:Bb] = true
scene_change scene_name
end
end
text.event :on_touch_up do |event|
if event.target
local_data[:Bb] = false
scene_change scene_name
end
end
end