Simple weapon animation

From Starsector Wiki
Jump to navigation Jump to search

Simple frame by frame animation of firing weapons can be implemented by using numFrames and frameRate in the weapon's .wpn file

numFrames sets the number of frames the animation has in total

frameRate sets how fast the animation frames are displayed

turretSprite & hardpointSprite are still used for the animation, where they set the file path and specific filename of the first frame

Important note The game engine is hardcoded to expect the frames to all be in the same folder, to have numbers at the end of the filenames and for the first frame to start at 0. It will then look for sequential frames in the same folder by increment that number. For example the first frame is filename animated_weapon00.png and the next, second frame must be filename animated_weapon01.png

The Assault Chaingun is a good vanilla example of this. It's .wpn file & animation frames respectively are found in

Starsector\starsector-core\data\weapons\chaingun.wpn  
Starsector\starsector-core\graphics\weapons\rotary\

There are known issues with precise synchronisation of sounds to weapon animations using this method, so it is recommended for continuous fire weapons. For example with the chaingun it doesn't matter exactly which frame the bullet leaves the barrel; it will still look good. As opposed to a slow firing single shot weapon like a crossbow

For information on how to make the animation frames, as opposed to how to implement it in the game, check the forum for tutorials such as Tartiflette's Animation Tutorial

Icon cross.png
At least two versions out of date. Last verified for version 0.8.1a. Please refer to Version History and update this page.

---

Return to Modding