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 / Sprite Animation

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Dec 2013 18:18 Edited at: 25th Dec 2013 18:21
Hi.
My Character have some Sprite Sheet that all have 6 frame. now I can't use PlaySprite( ) Function More than once, because all parameter for my sprite is same. and I don't want create Sprite for each Sprite Sheet.
How can solve this Problem?

Thanks.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Dec 2013 20:13
i think you can add your images together and then you can play them all for one sprite.
AddSpriteAnimationFrame
SetSpriteAnimation

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2013 12:40
Mean Combination all sprite sheet Together and make a one Sprite Sheet?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 26th Dec 2013 17:42
no, it means it makes a animation from some images at runtime.
see also the docu, just press F1 over command name

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2013 17:58 Edited at: 26th Dec 2013 17:59
could you show me your mean with this sprites?

Thanks

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 26th Dec 2013 19:35
ok, here, the tile images are different in size so i solved it so.



AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2013 20:41 Edited at: 26th Dec 2013 20:41
Thanks Markus.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 27th Dec 2013 11:41
could you explnation about setspritepositionbyoffset() and why use SetSpriteOffset(spr,getspritewidth(spr)/2.0,getspriteheight(spr))?
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 27th Dec 2013 12:59
Setspritepositionbyoffset, that uses the sprite offset, which was set to 50,50 when positioning the sprite - so the offset is like the new centre point of the sprite. It looks to me like Markus is setting the offset to the bottom-middle of the sprite, so when positioning it, the position is at the feet.

This is a good way to make movement more predictable, and collision detection is more straightforward as well, because the sprite offset means you'd be checking the feet, rather than having to offset your collision detection.

I am the one who knocks...
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Dec 2013 21:56
yes, without byoffset the sprite begins left,top edge because the
"image" coords begin there at 0,0 .
i like to use middle handle a sprite or for a character handle at feet.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670

Login to post a reply

Server time is: 2024-11-24 23:26:05
Your offset time is: 2024-11-24 23:26:05