IX. Object animations

Now that we have "locked" the player in our map by letting him collide with it, it's finally time that you can see him and he has animations. Running would be an extremely pleasant animation ... bored waiting for the next action of the player but also!


In the main menu of ™REDPILL you will find the button "Animations". Here you can define the animations for all objects of your game -- for an object like the player is, or the object of an opponent, or for an opening box. Simply everything that should move. In this menu you set the number of the animation, the start and end frame of the animation (do you have your notebook ready?) and how fast the animation should be played. There are many other settings, but this should be enough for a start. But before you can create any animation, an animation must be loaded. These loaded animations are called "Spritesheet".

For this tutorial I have created a spritesheet. You can download it on the right, above under "Assets".


Back in the ™REDPILL main menu you will find the button "Spritesheets". Plural. So... plural. A difficult topic. Why? Have a cookie, sit down and listen to me:

Basically, any ™REDPILL game can have multiple spritesheets. One for the player animation, several for the opponent animations. Maybe also the animation of an opening box. No problem at all. A spritesheet is a picture which is divided into frames, like a tileset is divided into tiles. Imagine this like the single frames on a film reel. At the very beginning is frame number 0 and at the very end, after the credits and the "second part alarm! Now, such a film is usually not a two-hour experience without editing (I scrub: as a rule, there are exceptions!). On the contrary. A film is quite often divided into scenes:

The protagonist approaches the house -- <cut> -- the protagonist opens the door -- <cut> -- the protagonist can't open the door because after two years of getting cigarettes, a ton of mail is lying on the floor behind it -- <cut>.

A ™REDPILL spritesheet looks similar:

The character runs to the right -- <cut> -- the character runs to the left -- <cut> -- the character stands around bored because the player has gone to get cigarettes -- <cut>.

Each of these scenes (running right, running left, standing around) consists of a series of single frames. If you play them one after the other with a sufficient speed, you get the impression of a flowing movement. Only that a ™REDPILL movie consists of many film rolls (i.e. spritesheet images).

All these single frames of the animation must be in a single frame. Now you have to know that in my experience it is difficult to convince ™REDPILL to load images larger than 320x256 pixels. The readme says something else, but that doesn't seem to work. If you should know more: Give me the info! Such a 320x256 picture is quite tiny, even by AMIGA standards. If your player is 32x32 pixels, that leaves just 80 frames for all frames of all animations of an object. So the spritesheet starts with frame 0 and ends with the cozy 79th frame, but what if you already used up all frames for your character and your opponents don't have any graphics yet? Well, then you need a second spritesheet and this is where the trouble starts. Back to the cookie and the dilemma:

Although the main menu item "Animations" shows you the spritesheet with the number 0, you can't choose another one, even if you have already created spritesheet 0, 1 and 2. There is always a 0 there, but you can choose the start frame and the end frame and this goes beyond that of spritesheet 0. So if your animation consists of 7 frames, you can still select an end frame beyond that.

I see question marks, hear a "HA?" and feel a Rage Quit. But wait, I can explain!

Imagine all your animations, in all the individual spritesheets, as one huge image. You have one picture with the player animations, one picture with an opponent animation and one for an opening box. If the player animation ends with frame 15 and the opponent animation has 8 frames. Then the opponent animation does not start with frame 0, but with frame 16, i.e. directly behind the last frame of the player animation. Crazy, I know. ™REDPILL simply connects all animations together and it's up to you to calculate when which animation starts and when it ends.

So grab your notebook and make a note of the order in which you have loaded the individual spritesheets, how many frames they cover and the start and end frames of the contained animations. Add up the number of frames of the individual spritesheets and make a note of the start frames of all sub-animations, because they no longer start with frame 0 after animation 0.


But now we finally want to load and configure the first spritesheet. We will come back to the trouble with the frame numbers again and again until even the last one has understood the dilemma. So let's click on "Spritesheets" in the ™REDPILL main menu. In the following screen, as the most obvious element, we can load an image.

TIP: Make sure that the spritesheets have the same palette as your tileset. No hardware sprites are used and there can only be a single palette for all elements of a level in ™REDPILL!

Once you have selected an image to load, it will be displayed in the upper area. If you use the spritesheet of this tutorial, the correct 32x32 pixel grid is already placed over the spritesheet, because by default ™REDPILL uses this size for animation frames. If you use a different frame size, you have to set it in the "Grid" section below. If everything fits, we ignore all other settings and click on "Slice Sheet". ™REDPILL now calculates for a while and directly after that all our frames are framed and numbered. That this numbering is only correct for Spritesheet 0 we have already discussed and we will also put it on tape from time to time. But now we click on "OK" and leave the Spritesheet menu.


With a loaded spritesheet we are now finally able to define animations. So click on the button Animations in the ™REDPILL main menu, so that we can continue directly.

As in other menus, we can select the number of the animation to be defined here. The default setting is animation 0 (notebook, diggi!). Since we have only loaded a single spritesheet at the moment, we can also use the frame numbers displayed under "Spritesheets" and count them in our graphics software. The tutorial spritesheet for the game character starts with frame 0 and ends with frame number 17, but the spritesheet is divided into the animation sequences "Run to the right", "Run to the left" and "Stand around". When we clicked on "Slice Sheet" in the spritesheet, it also showed us the frame numbers. So we can write down:

- Move to the right: Frame 0 - 6
- Run to your left: Frame 7 - 13
- Stand around: Fra,e 14 - 17

So we need at least 3 animations. Let's start with the default animation 0 and set the "Start Frame" value to 0 -- where it should already be there. "Num Frames" wants to know how many frames this animation has in total. A short recount will result in a value of 7 for this setting. For "Frame Time" we should set the value ".2" because our animation contains more frames than ™REDPILL would have expected.
On the right, next to the field "Anim 0" we can now click on the arrow pointing to the right to switch to animation 1 (Anim 1). Here we make similar settings, only that this animation starts with frame 7 but also contains 7 frames in total. This value is entered again in the field "Num Frames". Also for animation number 1 the "Frame Time" should get the value 0.2. The last animation, the bored standing around, we configure in animation number 2, so click again on the arrow to the right of the animation number above and enter number 14 as the start frame. The so called "Idle Animation" only has four frames, so we enter the value 4 for "Num Frames". In this animation we can leave the "Frame Time" at 0.5 because four frames are less than seven.

I hope you used your notebook to write down the numbers and names of your animations. Later ™REDPILL will only ask you for the number of the animation you want to use. The content is ™REDPILL vollkommen Wumpe ... it should be in your notebook!


Yeah, great! Three animations configured in one day. Let's have somebody do that first. In the animation menu you will find the item "Current Frame". Next to it is a number and next to this number is a button with an arrow pointing to the right. If you click on this button, you can play the currently selected animation. Play around with the "Frame Time" to find out which animation speed fits best to your game and your animation.

Now you know how to load spritesheets, how to use them in animations and how unhappy you can get when you have to calculate and write down all the funny frame numbers. But hey! This does not discourage us. On the contrary! In the next chapter we will look at how to use the animations built today on the game character, because how should ™REDPILL know when the game character should look like and how? Spoilers: It is triggered!

last update: 2022-05-16 -- v0.5.1