dopaluck.blogg.se

Gms2 spine2d tutorial
Gms2 spine2d tutorial









"worldAngle" = The rotation of the bone relative to the root of the animation Reference to its parent bone (this is a read only value). (ignoring any transforms by GMS2) as opposed to the scale with "worldScaleY" = The vertical scale of the bone in "global" space

gms2 spine2d tutorial

"worldScaleX" = The horizontal scale of the bone in "global" spaceĪs opposed to the scale with reference to its parent bone To the root of the animation (this is a read only value). "worldY" = The y position of the bone relative The root of the animation (this is a read only value). "worldX" = The x position of the bone relative to "yscale" = The local vertical scale of the bone, "xscale" = The local horizontal scale of the bone, "angle" = The local rotation of the bone relative to the parent bone. "y" = The local y position of the bone relative to the parent bone. "x" = The local x position of the bone relative to the parent bone.

gms2 spine2d tutorial

If the attachment was successfully created the function will return true and if it was not (you supplied an invalid sprite index, or the base sprite is not a Spine sprite) then it will return false. The function requires that you give the attachment a name (as a string) and then set the sprite_index and image_index to use, as well as the x and y origin (which can be different to that defined by the sprite in the sprite properties), and you can also set any transforms that you wish to be applied to the image when attached. Normally you would assign these attachments in your animation program (Spine), but with this function you can create your own at run-time using a sprite asset from your game. These are simply images that are apart from the animation but when attached will move along with the bone they are attached to. When you create your skeletal animation sprite, you can assign attachment slots and attachments to go in them. 0=normal, 90=turned 90 degrees’ counter-clockwise etc. > yscale: The vertical scaling of the image, as a multiplier: 1 = normal scaling, 0.5 is half etc. > xscale: The horizontal scaling of the image, as a multiplier: 1 = normal scaling, 0.5 is half etc. > yorigin: The y origin for the image being used. > xorigin: The x origin for the image being used. > ind: The image_index to get the attachment image from. > sprite: The sprite_index to get the attachment image from. > name: The name (as a string) of the attachment to create. When you pass a sprite index in as an argument, it will create an attachment slot using the name of the sprite as the string to name the slot (so using spr_sword, for example, will create an attachment slot "spr_sword"), and the slot will use the first image index (0) of the sprite, as well as its x and y origin offset, with a scale of (1,1) and a rotation of 0.

gms2 spine2d tutorial

Note that you can also pass a sprite_index in as the attachment, and that sprite will be used, or you can use -1 to remove the attachment from the slot.

gms2 spine2d tutorial

These names are defined by the animation program used, or (in the case of the attachment) when you call skeleton_attachment_create. With this function, you can set an attachment to a given slot, where you are required to give the names (as strings) of the slot and the attachment. > attachment: The name (as a string or a sprite_index ) of the attachment image.Ī skeletal animation sprite may have other images added as attachments, with these images being added to a named slot (the name is given when you create the attachment slot in your animation program) and they will be drawn along with the animation of the current sprite. > slot: The slot name (a string) to get the attachment of. You should also make sure to have a key frame at the beginning of every animation to prevent data from being held-over from previous animations, unless you plan on using separate animation tracks. If this is not the desired behavior, then you can set a "mix" value using skeleton_animation_mix and when you set a new animation, it'll be smoothly interpolated with the previous set. Note that setting a new animation in this way will reset the image_index to 0, starting the new animation set from the beginning of it animation loop. For example, if your sprite is for a platform game, then you may have a "jump" set, a "run" set and an "idle" set all contained within the one sprite and you can switch between them in the game using this function. These names are what you'll use to tell GMS2 which animation set to use at any time in the game. When you created your sprite (in Spine), you'll have defined multiple animations sets for different states and named each of them appropriately. Once you have assigned a skeletal animation sprite to your instance, you can then define which animation set it should use at any given time with this function. animname: The name (a string) of the animation set to use.











Gms2 spine2d tutorial