class Game_Interpreter
def spine_demo
spine_demo2
end
def spine_demo1
dir = "D:/Downloads/spin_demo/spineboy/export"
sp = Spine.new("#{dir}/spineboy.atlas", "#{dir}/spineboy-pro.skel")
sp.y = 50
sp.zoom_x = 0.25
sp.zoom_y = 0.25
sp.set_animation(0, "run")
sp.set_animation(1, "aim")
loop do
px = (Mouse.x - (Graphics.width / 2 + sp.x)) / sp.zoom_x;
py = -(Mouse.y - (Graphics.height / 2 + sp.y)) / sp.zoom_y;
sp.set_bone_position("crosshair", px, py)
if sp.get_event_triggered(0, "footstep")
Sound.play_cursor
end
sp.update
Fiber.yield
Input.update
if Mouse.click?(:L)
sp.clear_animation(2)
sp.set_animation(2, "shoot", false);
end
Mouse.update
end
end
def spine_demo2
skin_lib =
[
[
"skin-base"
],
[
"accessories/backpack",
"accessories/bag",
"accessories/cape-blue",
"accessories/cape-red",
"accessories/hat-pointy-blue-yellow",
"accessories/hat-red-yellow",
"accessories/scarf",
],
[
"clothes/dress-blue",
"clothes/dress-green",
"clothes/hoodie-blue-and-scarf",
"clothes/hoodie-orange",
],
[
"eyelids/girly",
"eyelids/semiclosed",
],
[
"eyes/eyes-blue",
"eyes/green",
"eyes/violet",
"eyes/yellow",
],
[
"hair/blue",
"hair/brown",
"hair/pink",
"hair/long-blue-with-scarf",
"hair/short-red",
],
[
"legs/boots-pink",
"legs/boots-red",
"legs/pants-green",
"legs/pants-jeans",
],
[
"nose/long",
"nose/short",
],
]
dir = "D:/Downloads/spin_demo/mix-and-match/export"
sp = Spine.new("#{dir}/mix-and-match.atlas", "#{dir}/mix-and-match-pro.skel")
sp.y = 50
sp.zoom_x = 0.25
sp.zoom_y = 0.25
sp.set_animation(0, "walk", true)
t = 0
loop do
if t % 60 == 0
skin_names = []
skin_lib.each { |s|
skin_names << s.sample
}
sp.set_skin(skin_names)
end
t += 1
sp.update
Fiber.yield
end
end
end