bendmorris / spinehaxe

Spine runtime for Haxe 3. Based on current AS3/libgdx runtimes.
Other
64 stars 28 forks source link

Question: Attachments #1

Closed theRemix closed 10 years ago

theRemix commented 10 years ago

How do you use the setAttachment() method?

is it used to add graphics to the skeleton?

Basically, i want to have a skeleton hold different items, should i put those graphics in Spine and hide/show them? or can i add graphics to the 'arm' of the skeleton?

bendmorris commented 10 years ago

You can add multiple images to a single slot in Spine, then toggle them at runtime using setAttachment. i.e. setAttachment("left hand", "sword") will attach the attachment called "sword" (defined and named in Spine) to the left hand slot or setAttachment("left hand", null) will remove any attachments from that slot.

If you wanted to add your own graphics, SpinePunk keeps track of hitboxes for each slot (hitboxes.get(slotName) will return a rectangle.) I find it easier to just do everything in Spine, as I can get the positioning just right.

theRemix commented 10 years ago

cool, thanks!