💀 GameMaker skeleton animation
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Examples
README.md
sk.gml

README.md

Game Maker skeleton system

sk

sk is an easy to use skeletal system for Game Maker Language by Nik Sudan. Please give credit when used, that's all I ask of you!

Massive thanks to Michael Savchuk for the sk icon!

Demo

Creating Skeletons

You cannot define a skeleton within Game Maker, sk loads in skeletons externally, using .sk files. These are structured like .ini files, and contain information about each joint's properties. A GUI for creating skeletons is available on itch.io for a very small fee for Windows only.

GUI

Setting Up The Skeleton

Simply import the .gml file into your project - preferably a folder within your scripts. Nothing else is needed with you and the scripts, you're done.

Skeletons are loaded using sk_import and return the skeleton's data for use with skeleton systems. This way you can load one skeleton that'll be used by loads of entities. Calling this in the Game Start or Room Start events are recommended. Use this function:

data = sk_import('pathToFile');

Once you've initialised the skeleton, you can now use with objects. You can set an object to become a skeleton by using the following function in it's Create event:

sk_create( data );

Now you've set it up, but the skeleton won't move. You need to update it, and this can be done with the Begin Step event. You can use an Alarm event if you want to call it less often, but it's a lot smoother when you don't do that. Simply call this function:

sk_update();

And that's it!

Making Joints Move

I take it you want to manipulate the joints and give it a cool, smooth animation. You can move a joint by calling the following function:

sk_setTargetAngle( jointID, angle );

The angle the skeleton is imported in at will be the zero value for angle. You can find out the jointID from your sk file or the creator.

Note: There is a function called sk_setAngle() in the library - this will immediately change the angle of the joint. The joint will move back to the target angle after you call this, so don't use it for animation.

You can then set the rotation speed of the joint with the following function:

sk_setRotationSpeed( jointID, speed );

The bigger the speed is, the faster it'll move (duh).

Drawing Stuff

Ok, you'll want to see your skeleton, right? You can call a little debugging function to see the skeleton in action:

sk_draw();

I wouldn't recommend using that for your final product. You can get the position and angle of each joint by calling these respective functions:

jointX = sk_getX( jointID );
jointY = sk_gety( jointID );
jointAngle = sk_getAngle( jointID );

Draw whatever you want on these, I won't hold you back.

Examples Of Use

Demo

Demo

Demo

Demo