game.loading do |loader|
loader.add :window, :system => "window"
loader.add :gui_item, :system => "gui_item"
loader.add :key, 3
end
game.on_init do
scene_change :start_scene
end
x = 10
y = 10
sprite_template :sprite_template_test do |sprite_template|
sprite_template.texture :key # テクスチャーの設定
sprite_template.motion :move do |commands|
commands.loop false
commands.move_to(lambda do |s| x end,
lambda do |s| y end, 20)
end
end
scene :start_scene do |scene|
scene.on_init do
s = scene.sprite :template => :sprite_template_test
(0...10).each do
if x < 20
x = 100
else
x = 10
end
s.change_motion :move
wait_time 1000
end
end
end