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 Studio Chat / Sprite bigger than the image it was created from

Author
Message
KamaShin
3
Years of Service
User Offline
Joined: 7th May 2020
Location:
Posted: 8th May 2020 18:30
Hi everyone,

the title says it all, almost:

I'm loading a 140 x 21 image, then create a sprite using the CreateSprite on this image... The image loaded is 140 x 21 (using GetImageHeight and Width respectively), but the sprite is 140 x 28.... why???



The result is a fat, ugly sprite T_T
Any idea?
Qugurun
Valued Member
9
Years of Service
User Offline
Joined: 8th Dec 2014
Playing: AppGameKit
Posted: 8th May 2020 21:32
Attach the file please.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th May 2020 00:33
you could try this workaround

SetSpriteSize ( iSpriteIndex, GetImageWidth( iImageIndex ) , GetImageHeight ( iImageIndex ) )

Its usually a good idea to use powers of 2 for sprite sizes

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
KamaShin
3
Years of Service
User Offline
Joined: 7th May 2020
Location:
Posted: 9th May 2020 09:36
Thanks for your answers, and thanks for the info on SetSpriteSize, if not for this problem, it's an interesting command.
I found why it did this : I was loading some image and sprites BEFORE the SetVirtualResolution... Once I swapped the two, everything went fine
KamaShin
3
Years of Service
User Offline
Joined: 7th May 2020
Location:
Posted: 9th May 2020 09:37
And yes, I added an extra invisible pixel to my image so that's it's 22 px height, and not 21

Login to post a reply

Server time is: 2024-04-25 08:57:37
Your offset time is: 2024-04-25 08:57:37