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 / spritesheet and setanimation question

Author
Message
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 10th Aug 2023 16:35
i have a spritesheet that is 7x7 images i try:

47 frames not 49 because the last two are empty
but it says the images is two small? id assume no matter the image size if your dividing it it couldnt be too small? even if the animation wouldnt match. does agk auto add a padding between frames or am i doing something wrong?
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Aug 2023 17:43 Edited at: 10th Aug 2023 18:00
7x7 is always 49 regardless of how many frames you actually use, so:

otherwise, you control your "47" via the additional, optional PlaySprite() parameters:

many sprite sheets will have multiple animations inside, so:

all using a single sprites sheet, for example, while that sheet could be 10x10 (100 frames).

say 1-25 are used by MySprite, perhaps 26-50 represent YourSprite, 60-100 may never be used.

you get the idea.
dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 10th Aug 2023 18:27 Edited at: 10th Aug 2023 18:30
ok, so even if i make the frame count 49 i still get the same error
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Aug 2023 18:30 Edited at: 10th Aug 2023 18:35
with SetSpriteAnimation(), yes. (responding to previous, before you edited...)
adambiser
AGK Developer
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 10th Aug 2023 18:53
You can use 47 as the frame count.

I wonder if using floats for frame width and height is affecting things. What values do GetSpriteWidth and GetSpriteHeight return? Why use the sprite's width and height instead of the sprite image's width and height? What is the size of the image?
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Aug 2023 19:02 Edited at: 10th Aug 2023 19:06
Quote: "You can use 47 as the frame count."

ack! so it will take the first 47 (assuming there are atleast 47?)
Quote: "...until the frame count is reached "

i always assumed w*h had to = count and wondered why AppGameKit made me do the math

otherwise, i'd mentioned the float values to them @ discord. the image dimensions:

dandrews
3
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 10th Aug 2023 19:16
i create the animationframes before adjusting the sprite size so i assumed it was the same as using the sprite image?
Aidan
User Banned
Posted: 10th Aug 2023 19:45 Edited at: 10th Aug 2023 20:02
Doesn't the AppGameKit command do the /7 for you.

Take away the /7 from your xfrsame and yframe and give that a whirl

As long as the sprite image is 7x7 exact 49 then sprite image will not complain of size issues. And then problem solve the last two empty slots.

Can you duplicate your last sprite at end two more times to fill it up perhaps or will this make it look odd or do you have other ideas of those two empty ones ?

Say sprite sheet is 350 x 350

350 / 7 = 50

So sprites need to be 50x50

7 across and 7 down

How ever yours is the full width and height needs to divide by 7 perfectly with 0 remainders

I think.... Hope that makes sense
adambiser
AGK Developer
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 10th Aug 2023 22:37
@dandews: I would check that the sprite width and height values are what you expect them to be. Then check xframe and yframe.

If the image is 5417x3471
5417 / 7 = 773.85714285714285714285714285714, rounds to 774.
3471 / 7 = 495.85714285714285714285714285714, round to 496
So the image would need to be 5418 x 3472.
You can use Floor() or Trunc() to get rid of the fraction if that works for you.

Login to post a reply

Server time is: 2024-02-26 12:20:18
Your offset time is: 2024-02-26 12:20:18