We already talked about character sets and how they are animated in the engine, but what if you have an animation that takes up more than 4 frames or a basic idle animation?
So, let’s say, I made this Laptop for my game and want to place it on a table where my character can approach and interact with it to open it:
Since it is just four frames, there is the intuitive and easy solution to align them in one of the columns of an empty 3x4 cell charsets (which is named !$anyname.png, the ! removes the offset and the $ tells the engine that we have only one charset instead of the 8 of a full sheet):
Which of the columns we use doesn’t matter. We could fill all three, but any of them will work the same way. In the end, single sheet or one of eight, left or middle or right column, four frames in the same column can be animated by having the character “turn” as below:
Since the laptop would “turn around” to face the player the event has a fixed direction until the action happens. This event is obviously incomplete, since it would reopen every time you interact with the event, either it needs to be closed again or lead to a different tab where it is already open.
But what if my Laptop scene got out of hand? Not only shall it open, but I also want it to switch on and open a text window:
With those seven frames it becomes more difficult to get them to work as I want.
The intuitive way to put them into a charset would be by utilizing one of the unoccupied columns:
But what shall we do with that? Expanding on the given event is not possible, as there is no way to “change column”, just to “change image”, which brings us to the same column of either another charset on the same sheet or a different sheet.
There are several things we can do to make our animation happen:
Our starting page looks just about the same as for the previous event, but instead of “ending” the animation, a switch or a variable is turned on (here a self switch):
This switch then activates the next page, where the event image is the first frame of the next column, the 5th frame in the animation sequence:
This page snugly fits to the first one, running on autorun and continuing where the first page stopped.
With just two more turns it shows frame 6 and 7, and since this page runs on autorun, we need to switch to a last page that does not.
Whatever happens on this page is up to you, important is that this page is also direction fixed so the event does not “turn” to one of the other frames if the player talks to it from a different angle.
But wait, you might say, you cannot change columns of the same sheet, but you can change the image - so if you have two sheets where the laptop is in the first column, you can get the whole animation being played properly by using just one page!
This can either happen by them being on separate small sheets…
…or by having both be individual sheets on one large charset…
…but one thing is important: the first frame of the second sheet that you want to be displayed must be in the same position as the last one of the first sheet.
This is because the “change image” command swaps out the sheet that is displayed, but keeps the frame that is shown and you cannot select otherwise, just the sheet as whole.
The whole event then would look like this:
All this trouble just because we cannot switch columns on the sheet? But there MUST be a way to do that!
And yes, there is. You can actually switch the column on the sheet you are on by a script call!
You can do this outside of a set movement command via
$gameMap.event(x)._originalPattern = y;
In this case, x is the ID of the Event you want to switch columns and y being the column on the sheet. The columns are referred to as you can see below:
As you can see, those y values only change the column and do not affect the row at all.
A working solution for this sheet and our animation could look like this:
You might notice that after the script call the wait is 20 frames instead of 10, this is because with 10 in my example weird glitches would occur.
If you want to use the script call inside of the movement route, you can do so by using:
this._originalPattern = y
This would look in editor like this:
As you can see, the glitching happened here as well.
Tip: If you want to use this script call, make sure the frames you want to switch between are in the same row. If you try to combine a turn command and this script call, you will see the turned frame of the row you are in flicker before the row is switched.
Clearly all options work and they all have their pros and cons. Using multiple pages is the version that is the most “forgiving” when it comes down to how the things are placed on the character sheet, while the other two require an optimized setup to work well, but on the other hand it might use up too many pages to work for you.
Whichever option you use might even differ in your own game, depending how the animation is supposed to play out, but it is always good to know all your options and how you can make them work!