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 / Problems with sprite animation

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th Jun 2013 20:03 Edited at: 14th Jun 2013 20:07
I'm getting artifacts on the edges around an animation frame.




On the left is from in-game. On the right is the original image. Notice the fuzzy edges around the character and the vertical pixels along the right edge of the frame. My setup and virtual resolution sizes match and I've carefully gone over the original sprite to make sure those were some tiny artifacts that got left in. Is there some kind of texture setting? It looks like it's scaling my sprite.


Here's the loading code:


Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Jun 2013 20:12
If your images touch the edges of the defined spaces allowed for them, you may see some overlap.

It is a good idea to have at least one pixel along all edges that is transparent.

Can you show us the chipmonk2.png?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th Jun 2013 20:30 Edited at: 14th Jun 2013 20:30
Here's the image:



Attachments

Login to view attachments
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 14th Jun 2013 21:14 Edited at: 14th Jun 2013 21:18
If possible, you could disable filtering, so pixelated, but it looks like that might suit the style anyway. I'm sure you can adjust the UV border on a sprite as well though. Lemme have a quick look at the help files...


SetSpriteUVBorder

Description

Controls how the sprite handles UVs that might extend beyond the bounds of the image during sampling, for example when the edge of the sprite is halfway across a pixel. By default (border=0.5) the sprite compensates for this by offsetting UV coords by 0.5 pixels inwards, however this means that the outer most pixels of the sprite's image may not show. border=0 removes this offset creating a pixel perfect reproduction of the image, but this may cause texture seams when trying to line up sprites of the same image that don't fall exactly on a whole pixel. Setting the border to 0 may also cause animated sprites, or sprites using a texture atlas, to 'steal' pixels from neighbouring images. You may also increase this effect by setting the border greater than 0.5 pixels.

Definition


SetSpriteUVBorder( iSpriteIndex, border )




Parameters
•iSpriteIndex - The ID of the sprite to modify.
•border - 0=half pixel offset, 1=no pixel offset

I got a fever, and the only prescription, is more memes.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th Jun 2013 21:38
While that command didn't help, you pointed me in the right direction now that I know what's causing it. My character position and speed are stored as floats for smoother movement and to manage acceleration. So I've used round() on the values when setting the sprite's position and that's corrected the problem.

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 14th Jun 2013 21:53
I think you may have been able to use SetSpriteSnap as well.

Login to post a reply

Server time is: 2024-11-24 15:43:12
Your offset time is: 2024-11-24 15:43:12