Studio › Manual › Bones (2D skeletons)

Bones: in the game (GML)

// Create
skel = skel_create("hero");
skel_play(skel, 0, "idle", true);
// Step
skel_update(skel, delta_time / 1000000);
// Draw
skel_draw(skel, x, y, 1, 0);
  • skel_play(skel, track, name, loop) plays now (crossfading), skel_queue(skel, track, name, loop, delay) plays after, skel_mix(skel, from, to, seconds) sets a crossfade, skel_set_alpha(skel, track, amount) layers a track partly, skel_current and skel_finished say what plays.
  • skel_draw_ext(skel, x, y, xscale, yscale, angle, alpha): a negative x scale faces the other way.
  • skel_set_skin (loads the skin's texture pages; see bones-pages: bones_prefetch, bones_flush), skel_set_ik_target / skel_clear_ik_target, skel_hit(skel, x, y) (the bounding box's slot, or ""), skel_bounds(skel), skel_bone_x / _y / _angle.
  • Drawing uses the graphics card (shd_bones moves every vertex by its bones, up to 48 bones a picture); meshes with a deform playing, and every picture when global.bones_gpu = false, are drawn on the CPU instead. It runs on the GMS2 VM and GMRT runtimes.

Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.