Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How do I create a Bone for a 2DSkeleton? e.g. for GUI, Groups, Layers

Author
Message
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 25th Nov 2019 15:49
Is it possible, to create a Bone for a 2DSkeleton?

My idea was, to use Bones as "groups" for Sprites, to move them around. Like for menus, windows and also as complex backgrounds.
Since a bone could "carry" more than one sprite and would also update all the attached sprites when moving and rotating, I thought that a bone could be used as a group of sprites. Also for Layers, GUI and other usecases.

But at this moment, I guess, it is not possible, to create a bone by myself ... or is it?

--> integer CreateSkeleton2D()
FixSkeleton2DToScreen( iSkeleton, mode )
FixSpriteToSkeleton2D( spriteID, iSkeletonID, bone, zorder )


And for detecting I could use integer GetSpriteHit( x, y )

But I can't create a window or group by my own, if I can't create a bone. So maybe, I only could create a Spine / Spriter file with one Bone and test it with that.
So what I still miss is: FixTextToSprite() or FixTextToSkeleton()

But I guess, for FixTextToSprite, it would be possible, to "UPDATE" that specific text to a specific sprite in the Loop.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 25th Nov 2019 17:08
I have done it with a Spriter-File and it works, so I guess, I can do some more "windows" with that method.


If the Skeleton is fixed to the Screen, but the Sprite not, the Sprite would not move with the Skeleton, I would consider it a BUG!!! Because Fixing it to the Skeleton is priority in my opinion.
So the "problems":

We still don't know, which Sprites are attached onto a Bone, can't find a command for that like GetSpriteIDFrom2DSkeletonBone ...

Also don't be able to "ask" the Sprites on which Bone they are. Or if some Sprite is fixed to something. There is no "Is" or "Get"
So I guess, all Sprites used for GUI have to be in another List also maybe with there Group or Categories.
Maybe in combination with SetSpriteGroup and GetSpriteGroup. Or with SetSpriteCategoryBit( iSpriteIndex, category, flag )

So maybe a Sprite could be set to the group of a SkeletonID and maybe has to be checked in a categrory for hits

nested windows are not possible without creating bones on the fly, but using bones as a window is somewhat possible. With more bones, it would also be possible, to attach more boney, every button could be on one bone and a bone could be animated as well with skeleton effects or tweening
Maybe it would make more sense to create a bone structure with more bones than needed, like a tree, one for the "window" and e.g. 20 for the buttons, but not using all of them.

Nesting Skeleton-Animations would be great e.g. for animations when hover about a button or so or clicking, also color-transitions are possible.

Attachments

Login to view attachments
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 26th Nov 2019 01:56 Edited at: 26th Nov 2019 01:58
A working proof of concept. The Angles gave me a headache, because I didn't know, that the SpriteOffSet has to be set after a re-size.
Maybe there is something still wrong with GetSpriteHit ... a Bug in App Game Kit, because the Hit-Mask is not there where the visual representation of the Sprite is.
It works, and I guess, it also could be done without the Dummy-Sprite I used. I used it, to track down the problem with the offset of the hit-detection.
I guess, it is still odd behavior.



Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-25 04:05:04
Your offset time is: 2024-11-25 04:05:04