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 / Can't figure out sprite offset for sprite sheet

Author
Message
Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 1st Jan 2014 20:40
I have a sprite sheet and can't figure out the offset. Do I set the offset to the whole sheet or to the frame? I have tried many different options and rearranging. This is my latest attempt but it doesn't work:



Thanks for your help
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 1st Jan 2014 20:57
do you have the image to go with it?

it would be easier to help if I could load it into agk with the same image to see whats actually happening.

Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 1st Jan 2014 21:03
here it is

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 1st Jan 2014 21:46
You set the offset relative to the size of the displayed sprite. It looks like your sprite is 96x96, so setting the offset to 48&48 puts it in the center of the sprite.

The code you posted looks like it is probably setting up properly. But the last two commands basically mean that it is not animating.

"playSprite(walkSwordmanS, 15,0,1,1 )" sets it to play only the first frame and not loop. Basically, not doing any animation at all.

"stopSprite(walkSwordmanS)" would then stop the animation at its current frame (if it was actually running).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 1st Jan 2014 21:52
beat me to it...lol!

Happy new years!

Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 1st Jan 2014 22:07 Edited at: 1st Jan 2014 22:19
I was working on something else with the animation. I took it out as it is no longer needed. Still though my offset is at 0,0. I do want it in the middle and that is why I used 48, but no avail.

edit: no matter what number I put in there it is always 0,0. I tried 48, 96, 1000 and 5000. I should have definitely seen something change.
Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 1st Jan 2014 22:24
Figured it out. I was using setSpritePosition instead of setSpritePositionByOffset. 48 did put it in the middle.

Login to post a reply

Server time is: 2024-11-24 23:31:41
Your offset time is: 2024-11-24 23:31:41