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 / [SOLVED] Parent-child relationship between sprites

Author
Message
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 19th Jan 2021 20:35
Is there any way to create such a relationship that AppGameKit will handle automatically?

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Jan 2021 22:00
This post has been marked by the post author as the answer.
I don't think so. You can track a pixel position in a sprite using GetWorldX/YFromSprite so i guess you could use that to "stick" one sprite to another
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 20th Jan 2021 03:46
Not directly within AppGameKit but you could use Spriter to create a 'Skeleton' and then fix a sprite to it with FixSpriteToSkeleton2D
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 20th Jan 2021 05:50
Thank you very much guys
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 20th Jan 2021 07:09
Please take a look at the following snippet:


I was expecting the box to be drawn rotated
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 20th Jan 2021 15:42
I found where I am wrong, the DrawBox will always draw a non-rotated box
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Jan 2021 00:29
I would create a sprite from the drawbox command and then rotate that
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 21st Jan 2021 03:08
I know this is already marked as solved, but thought my old DB spriter code might give some ideas in creating relationships between sprites. I never ported it to AppGameKit because there simply was no need.

https://forum.thegamecreators.com/thread/201922
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 21st Jan 2021 13:13 Edited at: 21st Jan 2021 14:52
I was just looking for a quick way to convert the coordinates of a sprite to the space of another sprite.

The GetWorldXFromSprite is exactly what I was looking for.
I think this command should exist with another name since it can be used to many programming tasks other than sprites
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 21st Jan 2021 14:27 Edited at: 21st Jan 2021 17:18
Quote: "I think this command should exist with another name since it can be used to many programming tasks other than sprites"

That's easily done:

Then in your code you can call NewCommandName() and the compiler will see it as GetWorldXFromSprite()
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 21st Jan 2021 14:50
Thank you, I didn't know that
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Jan 2021 20:58
There is the reverse of that command as well
GetSpriteXFromWorld()

Login to post a reply

Server time is: 2024-11-24 05:33:39
Your offset time is: 2024-11-24 05:33:39