gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Sprite Movement Question?

#152014 - Jinroh - Sat Mar 08, 2008 7:15 am

I've been pondering this for a little bit now. I'm re-vamping my Sprite Class and have been wondering what everyone does for their Sprite Movement.

How do you guys alter your X and Y Values Without Messing Up The Attr1 and Attr2 Values? Just curious to see what others are using.
_________________
The lone Wolf howls, driven by pride he presses on. Knowing not where he goes, but only where he wants to be.
~Me~

#152021 - tepples - Sat Mar 08, 2008 1:32 pm

Code:
attr0 = (attr0 & 0xFF00) | (y & 0x00FF);
attr1 = (attr1 & 0xFE00) | (x & 0x01FF);

To learn how this works, see Beginners' FAQ and search the page for "off the top".
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#152031 - Jinroh - Sat Mar 08, 2008 5:44 pm

Thanks Tepples, I was looking for something like that, but couldn't find it, sorry for the wasted post.
_________________
The lone Wolf howls, driven by pride he presses on. Knowing not where he goes, but only where he wants to be.
~Me~