Table of Contents:
- Part 1: Introduction to Level ExAnimation
- Part 2: Palette ExAnimation Explained
- Section 1: Setting up your colors
- Section 2: Simple palette ExAnimation
- Section 3: Other types of palette ExAnimation
- Section 3A: Type: Back Area Color
- Section 3B: Type: Palette Rotate
- Section 3C: Type: Palette + Working
- Section 4: Animating multiple colors
- Section 4A: Technical aspects
- Section 4B: Setup
- Section 4C: Writing our frame data
- Section 4D: Inserting it with Lunar Magic
- Section 4E: Using a shared AN2 file
- Section 5: Conclusion
- Part 3: Graphics ExAnimation Explained
- Section 1: The 8x8 Graphics Editor
- Section 2: Type: 1 8x8
- Section 3: The 16x16 Tile Map Editor
- Section 4: The Line types
- Section 4A: Type: 2 8x8s: line
- Section 4B: Type: 4 8x8s: line
- Section 4C: Type: 0x10 8x8s: line
- Section 4D: Other Line types
- Section 5: Speed tricks and the Stacked types
- Part 4: Triggers Explained
So, you want to learn ExAnimation? Then you’ve come to the right place. In my experiences with Super Mario World ROM hacking, I’ve come to learn quite a lot about ExAnimation, and I hope to share the knowledge I’ve gained with you. But first, there are a few things you should already know:
- You should know how to use Lunar Magic. This goes without saying.
- You should know how to insert ExGFX.
- You should know how to count in hexadecimal.
- You should know how to insert blocks using GPS.
- You should know how to hex edit. This will only come into play when we get into the really complicated stuff, but it’s a good skill to have nonetheless.
- A bit of ASM knowledge will help. For most practical purposes, it won’t be necesary. However, I will be going over a few fancy tricks you can do with ExAnimation, and if you have at least a basic understanding of ASM, you’ll be able to expand on my tricks and possibly create your own.
Part 1: Introduction to Level ExAnimation
So, what is ExAnimation, anyway? Its full name is Extended Animation. Simply put, it’s a method of creating new animations for use in Super Mario World ROM hacks.
Lunar Magic allows you to add new ExAnimations by clicking on the toolbar.
This is the ExAnimation window. There’s a lot to it. Intimidating, right? By the end of this tutorial, you’ll know how to navigate this window with ease. But for now, you’ll only need to focus on what I’ve highlighted:
That still seems like a lot, doesn’t it? But believe me, I’ve simplified this window as much as I possibly can for our purposes. Anyway, allow me to explain:
- Slot: This dialog allows you to select which slot to use. Lunar Magic allows you to add up to 32 (0x20) separate animations per level, one per slot. As a general rule, you should avoid using every slot. You’ll learn how to minimize the number of slots you use later on in this tutorial.
- Type: As you might expect, this dialog allows you to select what type of animation you want to create. We’ll cover every single one and how to use them later on.
- Frames: This indicates how many frames long your animation is. It seems self-explanatory, but there are a few details we’ll get into later.
- Destination: This is where your animation will go. This can be either a palette color or a graphics tile.
- Frames 00-3F: This is where you actually put your animation data. What you put in these boxes varies depending on what kind of animation you’re doing. You can use more frames by pressing the arrow buttons at the bottom-left corner, but you most likely won’t have to.
Now that we have all the basics covered, it’s time to learn how to do some ExAnimation.
Part 2: Palette ExAnimation Explained
Section 1: Setting up your colors
Open Level 105 in Lunar Magic. Open the Palette Editor (). Make sure animations are enabled ().
This is the Palette Editor window. You've probably seen this before, and even used it quite a bit.
Take a look at color 64. Don't know which one that is? It's Palette 6, Row 4.
Yep, it's that one. You may notice that it's animated. This is an example of palette animation, although not the kind we're going to focus on. This kind was part of the original Super Mario World, where ExAnimation didn't exist. It may be possible to recreate with ExAnimation, but not without some fancy tricks. Instead of doing that though, we're going to replace it.
Before we do anything, you'll want to enable a custom palette. You can do so by checking this box:
Now our palette won't affect how other levels look. This is important.
So, what is color 64 used for, anyway? Well, it's the main color of Yoshi Coins:
Rather than the familiar gold, we're going to make Yoshi Coins a nice silver color.
But first, we've got to disable the game's animation of color 64, or it won't change. To do that, open up the Animation Settings dialog by clicking on the toolbar.
That should bring up a window that looks like this:
Uncheck "Enable original game's palette animation" and select OK.
Now our palette window should look like this:
If for some reason color 64 looks different, it doesn't matter. As long as it's no longer animated, we'll be able to change it.
We're almost ready to begin the actual animation process, but something you should always do before palette ExAnimation is determine what colors you're going to use as the frame data. For this, we're going to use shades of gray already in the palette. Specifically, colors 33-37.
We're going to want to arrange them in the same way the values in color 64 were arranged. I'll spare you the trouble I went through finding that out.
First, hold Ctrl and left click color 33. Holding Ctrl again, right click on color 68. If you've done it right, color 68 should be the same as color 33. This is how you copy colors. Knowing that, can you copy color 34 to color 69? This is how it should look if you did it right:
Now, to make the Yoshi Coin shine like silver, we're going to need a very bright color. Open the color dialog for color 6C and select white.
Press OK. Your palette window should now look like this:
Those two blank spaces are important. We're going to make a gradient.
Hold Alt on your keyboard and right click color 69. Yes, color 69. Not color 68. Now, while holding Alt, right click color 6C. Now there should be a smooth gradient between colors 69 and 6C. It should look like this:
Now, we're going to set it up so that it'll form a nice loop when we start animating:
-Copy color 6B to color 6D.
-Copy color 6A to color 6E.
-Copy color 69 to color 6F.
If you did everything right, this should be your palette window:
Section 2: Simple palette ExAnimation
Now that we've got our colors laid out, we can begin animating.
Open up the ExAnimation window. We're going to be working in Slot 00. Make sure it's empty. If it's not, press the "Clear Slot" button.
For our Type, we're going to select "Palette".
For our Destination, we're going to write "64". Your ExAnimation window should now look like this:
That's all fine and good, but what the heck do we fill all those frame slots with? Well...
In the palette window, move your cursor over color 68.
See what I have highlighted? 2D6B is the SNES RGB value of color 68. The SNES RGB value is always what you're going to use when doing palette ExAnimation.
So, now that we know what to use, put 2D6B in the slot for Frame 00.
Now that you know where to look, let's input the rest of the values. This is where setting our colors up in a row like we did in Section 1 is going to come in handy. For Frame 01, we're going to put in the SNES RGB value of color 69, which is 3DEF. For Frame 02, we're going to put 5294. For Frame 03, 6B5A, and so on. Once you've put them all in (up to color 6F), your ExAnimation window should look like this:
Notice that I put "8" in the Frames slot, even though the last frame slot we used was 07. This slot works a little differently than you might expect. It still accepts hexadecimal values, but it doesn't count 0 like most other things. So, whatever you put in the Frames slot should be the last frame slot you used +1. Confused? Take a look at this:
(Sorry for the tiny font.) This chart corresponds to the correct frame number, up to 10. As you can see, "10" is in the Frames slot because the last slot used is Frame 10. I stopped at 10, but you could go past that and fill in Frame 11, Frame 12, etc... The Frames slot would always correspond with the last frame you used on this chart.
Now then, back to our animation.
Once you've set the number of frames, you can select OK. If you've done that right, color 64 should look like this:
And Yoshi Coins should look like this:
We've got the flashing part done, but we need to clean this up so that it looks more silver. To do that, we're going to use the three gray colors in Palette 3 that we didn't use back in Section 1.
-Copy color 35 to color 65.
-Copy color 36 to color 66.
-Copy color 37 to color 67.
You can also replace all the colors we laid out in Section 1 with black. We don't need them anymore.
Your palette window should now look like this:
And Yoshi Coins should look like this:
Congratulations! You've successfully utilized palette ExAnimation! But we've only scratched the surface of the wonderful world that is ExAnimation. Which brings me to...
Section 3: Other types of palette ExAnimation
So, you may have noticed that there are various other of palette ExAnimation. We're going to go over them in this section.
Section 3A: Type: Back Area Color
This is definitely the easiest type of palette animation to deal with, arguably moreso than the kind we just learned about. This is what we're dealing with:
You might be wondering why we're skipping over "Palette + Working" and "Palette + Working, Stop on Fade". While those do have some practical uses, we're not going to learn them until Section 3C, because they're a bit more complicated than other types. Anyway...
You've probably heard at some point in your life that the SNES is capable of displaying 256 colors at a time. But there's actually a 257th color you might overlook:
That's right, the background color. Since it's located outside of the normal palette grid, you can't animate it without using this type of ExAnimation.
Now, for the rest of this tutorial I will be including examples of ExAnimation from my own hack, COLORS 2, primarily because I've done so much of it and can easily provide examples.
I will of course provide a BPS patch when using examples from COLORS 2. If you want to follow along in this section, use this patch, and open to Level 1.
So, what are we going to do to the background color? Take a look at this:
As you can see, we've already got quite a bit of ExAnimation going on in this level. From the looks of it, we've got two different custom blocks: one that changes from pink to yellow to cyan, and another that changes from red to green to blue. Both blocks change at different times. What we want to do is create a background color animation that syncs up with whatever block is changing. Confused? Don't worry, it's not as complicated as it seems.
Let's start with our colors. If you want to put these into the palette editor yourself, you can use the PC RGB values provided:
|PC RGB value|
|SNES RGB value|
If you put those colors into the palette and opened up the color dialog for each of them, you would find that each color has the same Luminosity:
Each of them has a Luminosity of 117. Now, we could just animate these colors to the background, but that would be visually confusing since there are blocks of the exact same color. What we're going to do is reduce the Luminosity to 30 for each color.
And here are the new color values:
|PC RGB value|
|SNES RGB value|
Now we're going to plug those values into the ExAnimation window. But first...
Make sure you select Palette Back Area Color, Stop on Fade as your Type. This is essentially the same as Palette Back Area Color, but this one stops animating when the level fades out after reaching the goal. You'll almost always want to use this one.
As for our frame values, we're going to put each color in the order they appear in our table, but each one will last 8 frames.
Don't forget to set 30 as the number of frames! Remember, it's the last slot we used (frame 2F) + 1. Since it's animating to the background color, we can leave the Destination slot alone.
If you did everything right, the background color should change in sync with the blocks!
Section 3B: Type: Palette Rotate
This topic is a little harder to explain. Once again, I'll be using an example from COLORS 2.
PATCH. Level 1.
I've edited my Goal Sphere to look like this. Given the art style of COLORS 2, having an object of more than one color makes it clear that it's special. But we're going to make it stand out even more by animating it.
Remember how I said you should set up your colors before animating? This is the one case where you absolutely have to.
Notice colors D8-DD. They're the same colors we started with in Section 3A, once again laid out in the order of the rainbow. I put them in palette D because that's the palette the original Goal Sphere sprite uses.
Since the Goal Sphere is something that we'll see in more than one level, it would make sense to use Global ExAnimation instead of what we usually use. You can bring up the Global ExAnimation window with . Anything you enter in here will apply to every single level, so be careful.
For our Type, we're going to select Palette Rotate Left. We could've picked Palette Rotate Right, but it won't make a huge difference either way.
This is one of the rare times you'll use the Colors slot. It has one other use, but we won't be getting to that for a while. In this example, we want to animate colors D8-DD, which is 6 colors. The first color in the lineup is D8, which will be our Destination. We don't need to enter anything into the frame slots.
The Frame slot works a little bit differently here. Since Lunar Magic already knows how many frames there will be (6, because we're animating 6 colors), what we enter here is a frame delay value. Basically, it controls how quickly the animation plays. Entering a frame delay of 1 indicates that we want it to change every frame. If we put 2 here, it would change every other frame, and so on.
This is what the final product should look like:
Every frame, each color from D8-DD moves to the left and eventually loops back around. This is how palette rotation works.
A lot of newbies will simply animate each color individually until a similar effect is produced. But this method is better for a couple of reasons:
-It saves the creator time. Rather than spending time filling out six different slots, you only have to fill out one. And you don't even have to put anything in the frame slots!
-It saves the game time. Every slot you use adds more things that the SNES has to process. If it has to process too much, it can lead to slowdown.
-It ensures that all of the colors will change in sync. We'll get more into detail about why this is later on in this tutorial, but for now all you need to know is that animating across multiple slots will result in your animations not syncing up perfectly.
We're basically done, but there are variations of this Type we should cover.
-Palette Rotate Right: This is essentially the same thing as Palette Rotate Left, but the colors shift to the right each frame, rather than to the left. If we had used this, our Goal Sphere would look like this:
-Palette Rotate Left/Right, Rev on Trigger: These are a little harder to explain because we haven't gone over triggers yet. We'll explore these in more depth in Part 4, but for now all you need to know is that triggers do exactly what they say: they trigger an animation. These types reverse the direction of the animation when the trigger is set. I'll provide an example of how to use these types in Part 4.
Section 3C: Type: Palette + Working
This type is going to be a little harder to explain. This type is just like the regular Palette type we learned about in Section 2, but there's one difference: it copies the palette modifications to the two working copies of the palette in the game's RAM. If you don't know ASM, I'll give you a basic explanation: RAM, for our purposes, is the portion of the game that can be changed on the fly. Normally, the palette is only updated at the beginning of each level. This type updates the palette to reflect any changes we make to it during the level. Also, using this type means the SNES has to spend more time processing. It's not that big of a deal though.
Still confused? Don't worry, unless you're like me, you'll only have two real uses for this type:
-If you're using a One Shot trigger (which we'll talk about in Part 4).
-If you're using one of the Palette Rotate types on colors you've already animated. I have no idea why you would ever want to do this but it's certainly something you can do.
But if you are like me, you can do some pretty cool stuff with this type. But first, let's take a look at those two copies in RAM:
|$7E:0703||512 bytes||Palettes||The entire palette. It is only uploaded to CGRAM during the level loading routine. Also used during overworld load, but not all of it.|
|$7E:0905||496 bytes||Palettes||Copy of palettes 0-F from $0703-$08F2. Only the first half of palette F is included. It is used in overworld path events fading in ($04:EAA0), and level ending fade in/out ($00:AF9D).|
It looks like $7E:0703 is going to be best for our purposes. You probably could use $7E:0905 if you wanted, but I never have. If you do decide to use it though, you should keep in mind that it doesn't include colors F8-FF, presumably because they're never used by the game.
Enough talk. We're going to do something with this type.
PATCH. Level 1. You MUST use this version of uberASM.
Here's our scenario: In this level, we have a gimmick where pressing R changes the water level. Since button presses are disabled in this level intro, we're going to want to make the water level change by itself instead. We could create a timer with ASM, but we're going to something crazy instead. We're going to use ExAnimation as a timer.
Let's make our animation.
This is what our ExAnimation window should look like. I put 16 (0x10) frames of white and then 16 (0x10) frames of black, giving us 32 (0x20) frames total. I blacked out the frames after that to show where it stops. Even though every slot after frame 0F contains 0, the first 0x10 still count because we specified that we want 0x20 frames in our animation. I set our Destination as 1 for simplicity's sake. You can put whatever you want in these slots, I just tried to make everything as simple as possible.
This should be color 1:
So what are we going to do now? Well, this is the uberASM code we use to change the water level:
level1: LDA #$01 ;\ Disable pausing. STA $13D3 ;/ LDA #$FF ;\ TRB $15 : TRB $16 ; | Disable all button presses. TRB $17 : TRB $18 ;/ LDA $14 ;\ AND #$00 ; | Run code every frame... ORA $9D ; | except when sprites are not locked. BNE + ;/ LDA $18 ;\ AND #$10 ; | Proceed normally unless R button pressed. BEQ CheckSwitch ;/ LDA $14AF ;\ EOR #$FF ; | If pressed, flip the ON/OFF flag. STA $14AF ;/ CheckSwitch: REP #$20 ; LDA $14AF ; ON/OFF switch value. 00 = ON, anything else = OFF BNE Layer2Down ; If OFF, bring water down. Layer2Up: LDA $1468 ; Layer 2 position, next frame. CMP #$00CF ;\ If layer 2 will go too high, don't raise it. BCS + ;/ INC $1468 ; INC $1468 ; + SEP #$20 ; RTS ; Layer2Down: LDA $1468 ;\ If water level is already 0, don't make it fall. BEQ + ;/ DEC $1468 ; DEC $1468 ; + SEP #$20 ; RTS ;
If you're not skilled with ASM, that's ok. All we're going to do is replace the part where it checks for an R button press with some code that checks the value in color 1.
But... hold on. We know we're using color 1, but what do we do with that? We know that this animation type copies our changes to the 512 bytes starting at $0703, but where is color 1?
Well, we know that the palette is 512 bytes long. There are 256 colors on the palette, so each color must be 2 bytes in length (512/256=2). Since the palette starts at $0703, we can just start counting, right? $0703-$0704 contain color 0, so $0705-$0706 must contain color 1.
But we don't want to do that. What if we were checking, say, color 7C? Would you really want to count out each byte like that? No, we want a formula. Since each color is 2 bytes, we can multiply our color number by 2 and add $0703, the start of the palette.
[01 * 2 + 703 = 705]
The address we want to read is $0705.
level1: LDA #$01 ;\ Disable pausing. STA $13D3 ;/ LDA #$FF ;\ TRB $15 : TRB $16 ; | Disable all button presses. TRB $17 : TRB $18 ;/ LDA $14 ;\ AND #$00 ; | Run code every frame... ORA $9D ; | except when sprites are not locked. BNE + ;/ REP #$20 ; LDA $0705 ;\ CMP #$7FFF ; | If color 1 is white, lower the water level. BEQ Layer2Down ;/ ; Otherwise, raise it. Layer2Up: LDA $1468 ; Layer 2 position, next frame. CMP #$00CF ;\ If layer 2 will go too high, don't raise it. BCS + ;/ INC $1468 ; INC $1468 ; + SEP #$20 ; RTS ; Layer2Down: LDA $1468 ;\ If water level is already 0, don't make it fall. BEQ + ;/ DEC $1468 ; DEC $1468 ; + SEP #$20 ; RTS ;
Since we're using the value of color 1 to determine what to do to the water level, we can skip the ON/OFF stuff.
This should be our final result:
Before we finally wrap Section 3 up, I should make note of Palette + Working, Stop on Fade. This is the same type we just dealt with, but as you might expect, the animation stops when the level fades out at the goal.
Section 4: Animating multiple colors
This is quite possibly the hardest thing to do with ExAnimation. Remember when I said you should know how to hex edit? This is where that comes into play. Before we jump into it, let's talk about some technical aspects of ExAnimation.
Section 4A: Technical aspects
Super Mario World's original tile animations run at 7.5 frames per second (fps). Since the game itself runs at 60 fps, SMW splits up the tile animations it has to do among 8 different frames. This may sound convoluted, but it's all done to reduce the amount of processing the SNES has to do. Rather than processing all the tile animations at once every 8th frame, it only has to process one each frame.
Lunar Magic does the same thing. Rather than process all of your animations on the same frame, it splits them up across the game's 8 separate frames to reduce the amount of things the SNES has to process at once. You've already seen how it does this:
That's right, the Slot menu actually controls which frame your animations are processed in. To give you a better idea of how it does this, I've modified it a bit:
This chart shows which slots are processed in which frames. As you can see, Slot 00, Slot 08, Slot 10, and Slot 18 are all processed during Frame 1. Slot 01, Slot 09, Slot 11, and Slot 19 are are also all processed during Frame 2, and so on.
"But what does it matter? I just want to animate some colors," You might be thinking. Animating colors is definitely our goal here, at least for now. But what if you wanted to animate four colors at once, and when you stuck one in each slot from 00-03, you found that none of them were animating in sync with each other? That's when all this stuff matters. If you had instead stuck those four colors in Slots 00, 08, 10, and 18 instead, you would've been pleasantly surprised to find that they all animated in sync.
But let's go further than that. What if you wanted to animate more than four colors, and have them all animate in sync? What would you do then?
Why, you'd make use of the Colors slot, of course.
Section 4B: Setup
PATCH. Level 1.
Here's our scenario: We've got a level where pressing R activates a spotlight. While blocks on layer 1 are obscured by this spotlight, blocks on layer 2 remain visible.
What we want to do is animate the colors used by the layer 2 blocks so that they all turn white when the spotlight is turned on, thus making them only visible outside the visible parts of the spotlight.
The bulk of our work here is going to take place outside of the ExAnimation window. Why? Because, in order to make use of the Colors slot this way, we have to use direct offsets for our frame data. Direct offsets, in this case, effectively point to areas in the RAM where our actual frame data will be written. For reference, Mario's graphics start at $7E:2000, SMW's original animated tiles (AN1) start at $7E:7D00, and the extended animated tile area (AN2), which we'll use for graphics animation in Part 3, start at $7E:AD00. Most of the time, you'll want to use the last one when working with direct offsets, since AN2 can be changed on a level-by-level basis.
Confused? Hopefully it'll all make sense soon.
Before we begin, you're going to need three things:
-YY-CHR. Most of you reading this probably have it already. Once we begin Part 3, we're going to be using it a lot more.
-HxD. Or really, any hex editor. This is just the one I'll be using.
-A 6.5 KB, blank ExGFX file. Be sure to make a copy of this, as you'll definitely make use of it later on.
Also, you might want to put our base colors somewhere in the palette so that you can reference them. We'll be using these colors:
|PC RGB value|
|SNES RGB value|
This table may look familiar. It's nearly the same one we used in Section 3A, but with cyan and green swapped. The reasons for this stem from eccentricities with how colors are set up in COLORS 2, and bears no real significance other than the colors not being in rainbow order.
Section 4C: Writing our frame data
Open up the file you're using for AN2 in YY-CHR. If you're following along with this tutorial, it should be the 6.5 KB ExGFX file I just linked. It should look like this:
If you're using a different file, check out Section 4E. Otherwise, keep following along.
Now open the same file in HxD (or whatever hex editor you're using). It should look much the same:
Well, "the same." If every byte is 00, it's a blank file, just like it is in YY-CHR. This is where we're going to be doing our work.
Let's get a few things cleared up. Each color is going to have 2 frames: the color when the spotlight is disabled and the color when the spotlight is enabled. When the spotlight is enabled, each color is going to be white (7FFF). We'll have 6 colors in total. Each color is two bytes in length. Our base colors are 001F, 03FF, 7FE0, 03E0, 7C00, 7C1F.
Knowing all that, what do we put in the hex file? It's not that complicated, actually. We put frame 1 of each of our colors, and then frame 2. Let's put in frame 1's colors first:
This should work, right? Well... no. If we were to save it as is and do our animation with this, we'd get these colors in Lunar Magic:
|PC RGB value|
|SNES RGB value|
That's not right! If you look at the SNES RGB values of those colors, the high byte (the first two numbers) and the low byte (the last two numbers) are swapped, and some of them have a reduced high byte on top of that. What's going on?
Well, you need to know that when animating with direct offsets, as we are now, our data should be stored in little endian format, meaning the low byte goes first, and then the high byte. So all we have to do to fix this problem is flip the order of the two bytes that make up each color:
If we were to do our animation with this, we would get these colors:
|PC RGB value|
|SNES RGB value|
But we're not done yet! We still have to put in our colors for frame 2. Remember that frame 2 will be 7FFF for each one, and that the high byte and low byte are in the opposite order:
There we go! Now we have one frame of white for each color. Go ahead and save that as an ExGFX file to insert into your ROM. In my case, I saved it as "ExGFX91.bin" but you can put whatever number you want from 80-FFF.
This is optional, but if you want, you can open up your file in YY-CHR. You should have an 8x8 tile that looks like this:
Section 4D: Inserting it with Lunar Magic
Phew! It's all downhill from here. Once you've saved the file, insert your ExGFX with , then open up the Super GFX Bypass dialog ().
Set AN2 to match number of the ExGFX file you just saved. In my case, it's ExGFX91. Press OK.
Now we get to actually write our direct offsets. Open up the ExAnimation window.
For Type, we're using Palette. We're also using an ON/OFF trigger. We'll get into more detail in Part 4. For Colors, 6. Frames in our case will be affected by the ON/OFF trigger. Just put 1. And for our Destination, 51. Before we put in our frame data, let's press OK and re-open the ExAnimation window. Pay no mind to the resulting palette modifications.
That's strange, isn't it? All of our frame slots are now filled with 10000! There's actually a pretty simple reason for this: when the Colors slot is used with any type of palette animation except Palette Rotate, Lunar Magic converts all the frame data to direct offset format. This format requires each frame to begin with 1, and the remaining four numbers are the actual offset. I said back in Section 4B that AN2 starts at $7E:AD00, so we're going to use AD00 as our starting offset.
Take a look at the ExGFX file in HxD again.
The red outline indicates our first frame, and the blue outline indicates our second frame. Since our first frame starts at 00, our offset for frame 1 will be 1AD00 (10000 + AD00 + 00 = 1AD00). Since our second frame starts at 0C, our offset for frame 2 will be 1AD0C (10000 + AD00 + 0C = 1AD0C).
Our ExAnimation window should look like this:
And sure enough, if we test it out, the layer 2 blocks should all turn white when the spotlight is activated by pressing R:
Section 4E: Using a shared AN2 file
So that was all fine and good, but it was also a bit too simple. Let's kick it up a notch. What would you do if you were already using AN2 for something else in the level? And what would you do if you had more than two frames? Let's give it a try.
PATCH. Level 1.
In this level, the colors gradually get grayer as you progress. We want to show that in this level intro. We're going to do that by animating the six colors so that they lose their saturation over time. But the problem is we already have tiles in this level that are animated. So what are we going to do?
This is the file our animation is using. My reason for including the last picture in Section 4C was to show that animating multiple colors doesn't take up a whole lot of space. It's perfectly reasonable that we can do the animation we need within the remaining space in this ExGFX file.
If for some reason you're completely out of space in whatever file you're using, you have a couple options:
-Use AN1 at the cost of overwriting the graphics used by some of the game's original animations. This is probably the best option unless you're doing a strictly vanilla hack for some reason. Although, if that were the case, would doing multi-color animations really qualify as "vanilla"?
-Overwrite part of Mario's graphics. Severely not recommended.
-Use an Alt ExGFX file, which we'll talk about in Part 3.
But if space isn't a problem for you, your palette animation can coexist with your graphics animation. \o/
My recommendation is to fill an 8x8 tile with any color that isn't the first color on the palette. Like this:
Save it like that, then open the file with HxD.
If you did what I said, you'll likely find a couple FFs amidst a sea of zeros. Where those FFs start is where you'll want to start inputting your colors. In our case, we're going to start with an offset of E00. Before we do anything else, let's clear out those FFs so that we have a nice, clean slate to work with.
Now we're going to input our color values. I went ahead and made a gradient of each color that fades to a PC RGB value of (128,128,128). Here's our table:
|SNES RGB value|
|SNES RGB value|
|SNES RGB value|
|SNES RGB value|
Putting them in won't be hard. Remember, frame 1 of each color goes first. Then frame 2, and so on. Also remember to swap the high and low bytes of each color.
If you enter everything correctly, it should look something like this (sans my modifications, of course):
We're going to set up our ExAnimation window like this:
We'll be using 30 frames because we want the animation to take a little while. This means each color will last 12 frames. I'm growing increasingly uncomfortable using so many triggers before we've formally talked about them, but for now just use a One Shot 00 trigger.
For our direct offsets, we're going to take our base offset, AD00, and add the offset we started at when we did our hex editing, E00. For our first 12 frames, we're going to enter 1BB00 (10000 + AD00 + E00 + 00 = 1BB00). For our second 12 frames, we're going to enter 1BB0C (10000 + AD00 + E00 + 0C = 1BB0C). For our third 12 frames, we're going to enter 1BB18 (10000 + AD00 + E00 + 18 = 1BB18). And for our final 12 frames, we're going to enter 1BB24 (10000 + AD00 + E00 + 24 = 1BB24).
Our ExAnimation window should look like this:
Check it out in-game. It should look like this:
(Note: The colors shouldn't revert back to normal, that's just a consequence of being an animated GIF.)
Section 5: Conclusion
I'll probably be doing one of these at the end of each part, as a way to wrap things up.
All I have to say is... wow. I've been doing palette ExAnimation for years now, and it's amazing how much I've learned. As far as I know, there's nothing really left to cover on the topic. Certainly there are more things that you can do that I didn't talk about, but if I gave you every specific example, well... this tutorial would never end.
I really have to say, while I had a lot of fun writing up this part of the tutorial, it was exhausting. I'm writing this after about 8 consecutive hours of working on Section 4 and my arms are actually sore. Translating my skills into an explanation simple enough for others to understand isn't easy. For that matter, neither is making 116 images, many of them animated to illustrate my points.
All in all, I hope you enjoyed Part 2. Or at the very least, I hope you learned something. Up next is Part 3: Graphics ExAnimation Explained.