#53171 - QuantumDoja - Tue Sep 06, 2005 3:41 pm
Hi, I have a sprite, which is made up of 3 stages, like:
sprite 1: leg up a little
sprite 2: leg up
sprite 3: leg down
and when they play...they produce a walking sprite.
I store these sprites in memory as 3 individual sprites. how can i say in code which sprite should be displayed...dont worry about the animation stuff i can do that...
I just need to know how to swap which sprite is drawn to the screen by referencing a different part of memory
_________________
Chris Davis
#53172 - NoMis - Tue Sep 06, 2005 3:50 pm
If you have all 3 sprites in memory at once, you will only need to change the character base block of the OAM Entry to point to the other sprite.
NoMis
_________________
www.gamedev.at - The austrian gamedev site
hde.gamedev.at - The Handheld Dev Env plugins for Eclipse
#53173 - QuantumDoja - Tue Sep 06, 2005 3:56 pm
are we talking attribute 2 here?
_________________
Chris Davis
#53176 - Fatnickc - Tue Sep 06, 2005 4:18 pm
Perhaps I'm using bad coding here, but I'd just make the spirte, then simply copy the new sprite into memory when you want it. It works, and you have more space for other sprites, but there are better ways.
For example, combining all 3 sprites into one, then just 'cutting in' at a certain memory address in attribute2.
#53230 - QuantumDoja - Tue Sep 06, 2005 10:07 pm
woohoo..it works changing attribute 2.
btw Fatnickc.....i didnt do it your way as i want mine to work a bit different...thats all :-p
_________________
Chris Davis
#53264 - tepples - Wed Sep 07, 2005 3:19 am
Changing attribute 2 works, but if you start running out of sprite cel VRAM (32 KiB in tile background modes or 16 KiB in bitmap background modes), you'll have to use the VRAM tile swapping method that Fatnickc mentioned and that I have explained in detail. And no, it's not bad coding, as at least Mario Kart Super Circuit, Sonic Advance, and Kirby: Nightmare in Dream Land have used it.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#53280 - Fatnickc - Wed Sep 07, 2005 7:14 am
Glad to hear it's not bad coding!
QuantumDoja - Later on, when you have a heck of a lot of sprites on-screen at one time, it would be in your interests to copy the sprites into memory as and when you need them for the animation, especially if you're using a bitmap mode!