Jump to content







Photo

Learning sprite flickering and NMI{instruction}

Posted by Kiwi, 14 March 2011 · 52 views

Today, I experiment adding stuff into the NMI{}. I used the Milon's Secret Castle mock-up source code to experiment with and not break the main Mock-up program. The first level of Milon' is already set up and I determined what sprite needed to be flickered. I already experimented with flicker with the ghost program, but it was too slow.

I chosen Milon's color red to flicker because it's his least amount of colors. I set up the sprite attribute RAM to store the location, color and pattern, to load into the sprite cell. Then worked with the NMI because I was curious and try to experiment with that bracket to see how it works.

First thing I did with NMI was to use if statement.

nmi{

if(frame==0)
{
sprite[4].x=spritex2;
...
sprite[10].pattern=spritepattern2;
frame=1;
goto here;
}

if(frame==1)
{
sprite[4].x=spritex;
...
sprite[10].pattern=spritepattern;
frame=0;
goto here;
updatesprites(0,24);
}
here:
}
It was too slow. Then it comes to my sense that this isn't how the NMI works. It works like a series of commands while functions, like pushing down on the DPAD would not break the NMI branch or something. I'm still new at this. I tried another approach, and it works a lot better, but not 30hz flicker, but better.

nmi{

sprite[4].x=spritex2;
...
sprite[10].pattern=spritepattern2;
updatesprites(0,24);
delay(1);


sprite[4].x=spritex;
...
sprite[10].pattern=spritepattern;
updatesprites(0,24);
delay(0);
}

This works a lot better. I thought the NMI would be processed all in one frame so that's the reason for the if. I added the heart flashing animation to it.

I also tried to fix the scrambled sprite issue, but failed. I worked on Text Adventure a little bit and I need to write down part 2 since it is in my HEAD. I have about 13KB left. I planned to have a part 2 screen made. I better get the cave and dragon part finished before making the screens. So the core of the game is completed. Not to mention game breaking may occur.




May 2012

S M T W T F S
  12345
6789101112
13141516171819
2021 22 23242526
2728293031  

Recent Comments