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 / SetSpriteAnimation

Author
Message
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 22nd Sep 2016 14:03 Edited at: 22nd Sep 2016 17:16
Could someone please give me a piece of code on how to use the SetSpriteAnimation function, given that:

- I use the percentage system
- The original artwork dimension is: 1920 x 1080 pixels
- A have a sprite sheet of two animation frames and the size is 16 x 32 pixels

Thanks in advance
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd Sep 2016 02:41
I use something like this;


Note that playsprite will allow you to change FPS, Looping and From/To Frame. Just check the doco for syntax.
Hope this helps

george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 23rd Sep 2016 15:48
OK, but what if I don't know the sprite dimensions?
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 23rd Sep 2016 20:52
Quote: "OK, but what if I don't know the sprite dimensions?"

If you know how many rows/columns there are in the spritesheet, you can divide the width of the spritesheet by the number of columns to get the frame width in pixels. Likewise, divide the spritesheet height by the number of rows to get the frame height in pixels..

Login to post a reply

Server time is: 2024-04-27 02:06:44
Your offset time is: 2024-04-27 02:06:44