S&box Wiki

Creating animated sprites

This page assumes that you know how to create a particle effect using the sprite renderer. If you do not, you can follow this wiki page: Creating your first particle effect

Preparing the animated sprite

Before we get started you need at least a couple of .png or .tga images for the animated sprite.

When you have your image files prepared, we need to create a .mks file.
The .mks file describes how our animation should display our images.

  • Create an .mks file in the same place as your .png or .tga files.
  • Populate it with the following snippet.
sequence 0 loop frame a_circle_001.png 1 frame a_circle_002.png 1 frame a_circle_003.png 1 frame a_circle_002.png 1
  • Replace the a_circle_00X.png values, with the name of your image files.
  • Add or remove frames depending on how many images that are in your animation.
If you want to learn more about .mks files you can read the Valve documentation

Creating a .vtex file

  • Now that we have our .mks file prepared, we need to link to it in a .vtex file, so we can use it in the Sprite Renderer. If you do not know how to create a .vtex file, follow this wiki page: Using custom sprites

Using the animated sprite

  • Select your new sprite in the material property on the Sprite Renderer
  • Increase the animation rate property on the Sprite Renderer

Congratulations! You have just created and used your first animated sprite in the Particle Editor!


Example of an animated sprite