game.loading do |loader|
loader.add :window, :system => "window"
loader.add :gui_item, :system => "gui_item"
loader.add :nd3_image, 9
end
game.on_init do
set_window_image :window
set_gui_image :gui_item
scene_change :start_scene
end
scene :start_scene do |scene|
scene.on_init do
scene.add :image, :name => :nd3, :template => :nd3_template, :center_position => [400, 225]
scene.event :nd3, :on_click do
speak "コンニチハ・・・"
end
speak("見えているのはnd3というロボットです。")
speak("タップすると話をしてくれます。タップしてみてください。")
end
end
sprite_template :nd3_template do |st|
st.texture :nd3_image
st.src_size 32, 32
st.dest_size 32, 32
st.center_offset 16, 16
st.collision :rect, :position => [0, 0], :width => [32, 32]
st.animation :default do |commands|
commands.loop true
commands.copy_rect :frame => 16, :src => [0, 0]
commands.wait_animation
commands.copy_rect :frame => 16, :src => [1, 0]
commands.wait_animation
end
end