[4.5.9] Macro for cycling (animating) a sub palette

BinaryLab

New member
Hey everyone!
Palette cycling is such a cool effect, right? You can make waterfalls, lava, and bosses look way more cooler.
Researching the topic a came across this awesome thread with the solution:

http://www.nesmakers.com/index.php?threads/rotating-colors-on-a-sub-palette-for-nesmaker-4-5-6.5760/

Shoutout to everyone involved, @dale_coop, @Artix, @CutterCross, and many others.
Special thanks to @Bucket Mouse for point out that I didn't add the control flags in the zip files.

I thought I could give small contribution as well. I took the part that actually cycles the palette and encapsulated it in a macro, so the code looks cleaner.
Also, I'm attaching an example of game timer, used to call the CyclePalette macro. If this is the first timer you are using, just go to Script Settings and look for "Handle Game Timer" and point it to the file doGamTimers.asm in attachment. You will need to create variable counter in your zero page (mine is called paletteCycleTimer). Read the comments within the code for more information.


Instructions:
Step 1 - Create a variable called paletteCycleTimer on your Zero Page
Step 2 - Place the file doGameTimers.asm in your folder GameEngineData\Routines\BASE_4_5 (any subfolder you like. I use \Custom ). Now, under Project Settings > Script Settings find Game > Handle Game Timers and point it to the doGameTimers.asm. Alternatively, if you're already using timers, just append the contents of doGameTimers.asm to your own timer script.
Step 3 - Rename the User Flags 13 and 14 to something like "Cycle Palette 3" and "Cycle Palette 4". You can, of course, use other flags. Just change the code.
Step 4 - Place the macro CyclePalette.asm in your folder GameEngineData\Routines\BASE_4_5\System\Macros
Step 5 - Under Screen Info, click on "Cycle Palette X" to enable it for a particular screen.
 

Attachments

  • CyclePalette.zip
    973 bytes · Views: 43
Last edited:

Bucket Mouse

Active member
Here's something extra you can add. Since you probably don't want palette cycling on every screen, you can fix it so that it only runs when a Screen Flag is checked. I have mine on User Flag 03:

Code:
 LDA updateScreenData
    AND #%00000100
BEQ +
  JMP SeeYaLaterPalleteMallet
+
"PalleteMallet" is a line name from the original version of the script. You can use that or whatever other name you can think of, as long as it's the last line of the script.
 

BinaryLab

New member
Here's something extra you can add. Since you probably don't want palette cycling on every screen, you can fix it so that it only runs when a Screen Flag is checked. I have mine on User Flag 03:

Code:
 LDA updateScreenData
    AND #%00000100
BEQ +
  JMP SeeYaLaterPalleteMallet
+
"PalleteMallet" is a line name from the original version of the script. You can use that or whatever other name you can think of, as long as it's the last line of the script.
Thanks! I forgot to add something like that on the script. I'm actually using it myself. Again, thank you for pointing out.
 

DrJondo

New member
Hello,
this is my first post and i already need some help.
If this is the first timer you are using, just go to Script Settings and look for "Handle Game Timer" and point it to the file doGamTimers.asm in attachment.
I am using the MOD_ArcadePlatformerBase 4.5.9 but there is no "Handle Game Timer" in my Script Settings/Game.
There is a "doHandleGameTimer.asm" in the /BASE_4_5/Game/Subroutines/ folder that looks like this:
;;; handle game timer.
LDA gameTimerTicks
CLC
ADC #$01 ;; change this to how fast you want the timer to run.
STA gameTimerTicks
LDA gameTimerLo
ADC #$00
STA gameTimerLo
LDA gameTimerHi
ADC #$00
STA gameTimerHi
if this is the one that goes in to Script Settings /Game how do i point it to doGameTimers.asm

greetings
DrJondo
 

CluckFox

Active member
Hello,
this is my first post and i already need some help.

I am using the MOD_ArcadePlatformerBase 4.5.9 but there is no "Handle Game Timer" in my Script Settings/Game.
There is a "doHandleGameTimer.asm" in the /BASE_4_5/Game/Subroutines/ folder that looks like this:

if this is the one that goes in to Script Settings /Game how do i point it to doGameTimers.asm

greetings
DrJondo
Handle Game Timer is normally blank in the ArcadePlatformer module so it can be customized by game makers. Here is the position in the Script Settings where it lives. Create your own ASM file and use it here. The contents will be executed every cycle of the main game loop.

1614444903429.png
 

DrJondo

New member
Ah, thx
so i just renamed the "doGameTimers.asm" from the download to "doHandleGameTimer.asm" and put it in Script Settings /Game/
now its working.
 
Top Bottom