Make a pixel art hit flash

Updated · Adib Khan

A small green slime that flashes pure white for a moment, then pure red, then returns to green
The hit flash made for this page: a slime, held for 300 ms, then a 70 ms white frame and a 70 ms red one. Open it in the editor.

What a hit flash is

When something is hit in a game, it flashes. The character is repainted in a single bright colour for a moment, and then goes back. It is a very old trick and it still works, because it tells the player at once, with no sound and no text, that something landed.

It is also the cheapest animation in this set. A hit flash needs no new drawing at all. The flash frames are the normal frame with every colour replaced. If you can draw a character once, you can flash it.

Open the slime in the editor to try it. It has three frames: the slime as drawn, a white copy and a red copy. The slime is the only frame that was drawn by hand. The other two were made in the editor with the method below.

Open the slime and hit it.Open the editor

Make the flash frames

The Bucket has two modes. The usual one fills the connected pixels of one colour. The other, All, fills every pixel of that colour on the frame, wherever it is. That is the one for a flash: tap a colour once and it changes everywhere.

  1. Press D on the normal frame. A copy appears after it and becomes the current frame.
  2. Choose the Bucket (press G, or the Bucket in the toolbar). Tap it again if its options are not showing, and choose All. Its label reads "All, fill every pixel of this colour".
  3. Pick white in the palette.
  4. Tap each colour of the slime once. The bright green body, the darker green base and the black pupils: three taps. The highlights are already white. When the last colour goes, the slime is a white silhouette.
  5. Press D on the white frame, pick red, and tap the silhouette once. Every pixel of it is white, so one tap turns the whole thing red.
The PixelFlipbook editor on the second frame of the hit flash with the Bucket tool chosen and its options showing, the All mode selected, a pure white slime silhouette on the canvas and three frame thumbnails below
The white frame, with the Bucket on All. Each tap changed one colour everywhere on the frame.

Each tap is one step, and Undo (Ctrl+Z) takes it back, so you can try a different colour for the flash with no risk.

The three frames

  1. Normal (300 ms). The slime as drawn: a bright green body, a darker green base, two white highlights and two eyes with black pupils.
  2. White (70 ms). The same shape in pure white, with no eyes. A silhouette that is as bright as the sprite can get.
  3. Red (70 ms). The same shape in red. Red is the damage colour, and it lets the flash fade out instead of ending on a blink.

The loop then goes back to the normal frame. So the sequence is a long rest, a white flash, a red flash, and the rest again. In a game, you would play the two flash frames once, when the hit lands, and stay on the normal frame the rest of the time.

The PixelFlipbook editor on the first frame of the hit flash: the green slime on the canvas, the Duration box reading 300 and three frame thumbnails below, the slime, a white copy and a red copy, with 300, 70 and 70 ms under them
The normal frame, held for 300 ms, with the white and red copies after it.

Set the timing

A flash only works if it is quick. Longer than about a tenth of a second and it looks like a colour change, not a flash. Here each flash frame is 70 ms, so the whole flash is 140 ms and the loop is 440 ms. The normal frame is held at 300 ms so the slime reads before it flashes again.

A duplicate keeps the time of the frame it came from, so set the times once the frames are made. Use the Duration box beside the timeline for each one (on a phone, Expand timeline, then Frame actions, then Set duration). The editor accepts 10 to 65535 ms, and 70 is a multiple of the 10 ms step a GIF stores, so it comes out as set.

Export the GIF

Press Ctrl+E, choose GIF and press Export GIF. The GIF plays the three frames and loops, so you see the slime get hit again and again, which is useful for a post but not what a game does. For a game, export the frames as a sprite sheet with the JSON (see the sprite sheet guide) and play the flash frames from code, once.

If you tag frames 2 and 3 as "hit", an engine can find them by name. The Godot guide shows how tags become animations.

Tips

For a character that moves, the jump guide is a good next page.