Trouble Creating Metasprite Animations

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
User avatar
Zachjac
Posts: 5
Joined: Sun Jan 08, 2017 2:26 pm

Trouble Creating Metasprite Animations

Post by Zachjac »

So I've been working on my own NES project recently (written in ASM6), and I've had some trouble making a working player animation with metasprites. For now, I'm just trying to get an idle animation where the player blinks periodically. I've tried making tables of Animation sequences, which contain the duration of the frame and the location of the metasprite, but nothing I've tried has proven successful, and I feel like my code is getting too confusing for it's own good, prompting me to wonder if I'm even going in the right direction, or if there's a much simpler way to do metasprite animations(probably the latter). I've looked through the wiki and forums, but I haven't been able to find anything suggesting a more effective method. Am I on the right track? Is there a better alternative to what I'm doing? I'd love to know! Attached is the code and chr. for the program. Code concerning player animation starts at lines 246, 416, 441, and 604.
Attachments
mario.chr
(8 KiB) Downloaded 119 times
NESGame.asm
(19.87 KiB) Downloaded 135 times
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Trouble Creating Metasprite Animations

Post by pubby »

What isn't working? I think your approach is fine.
User avatar
Zachjac
Posts: 5
Joined: Sun Jan 08, 2017 2:26 pm

Re: Trouble Creating Metasprite Animations

Post by Zachjac »

pubby wrote:I think your approach is fine.
OK that's good to hear.

I think my main problem is in the UpdatePlayerAnim routine. What I want it to do is to change the PlayerFramePtr to the next frame of animation in the sequence every time that PlayerAnimCounter reaches zero then looping back to the beginning once it reads a frame length of zero, but that's proving to be easier said than done for me. I think the fact that DrawPlayerAnimFrame takes place during the NMI makes it harder to deal with, since the subroutine's already expecting the animation + frame to be loaded in to the two pointers. Is it possible for me to move updating sprites into the main loop, or does it need to be in vblank? Or should I just load an initial "default animation" during reset?
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Trouble Creating Metasprite Animations

Post by dougeff »

Is it possible for me to move updating sprites...from vblank
The sprite / OAM DMA transfer needs to be during vblank. From a buffer. You can fill the buffer any time.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
Zachjac
Posts: 5
Joined: Sun Jan 08, 2017 2:26 pm

Re: Trouble Creating Metasprite Animations

Post by Zachjac »

Wow, hearing you say that now makes makes me realize how dumb that last question was. Thanks!

EDIT: Just got the idle animation working properly!
Post Reply