EtG Modding Guide
  • ETG Modding Guide
  • Getting started
    • Modding EtG: Installing Mods
    • Modding EtG: Creating a Mod
    • Uploading a Mod
    • Useful Tools
      • Using IlSpy
  • Making An Item
    • Creating A Passive
    • Creating An Active
    • Creating An Ammolet
    • Creating A Guon
    • Synergies
  • Making a Gun
    • Creating A Gun
      • Setting Up Gun Sprite Folders
      • Creating Gun Jsons/Jtk2ds
        • Pixel Measurement Conversions
    • Setting Up Projectiles
      • Adding Components To A Projectile
      • Projectile HitEffects (Visual Effects)
      • Adding status effects to a projectile
    • Continuous Fire Animations
    • Gun Ammo Types
  • Custom Characters
    • Creating A Standalone Custom Character
  • Making a Floor
    • Introduction
    • Setup
    • Making The Dungeon
    • Tileset
    • Rooms
    • Making the flow
    • Making the Entrance
    • All Files
  • Text, Text Boxes, Etc
    • Textboxes
    • Text Formatting
  • Sounds
    • Using Custom Sounds
    • Customising Gun Sounds
    • Basegame Sound List
    • wwise Sound Dump
  • Misc
    • Making Asset bundles
    • Assetbundles: How-To
    • How to create a hook
    • Creating A Command
    • Subscribing Methods to Actions
    • Reversing Player Controls
    • Undodgeable Projectiles
    • Creating An Enemy
  • Shaders
    • Creating Shaders
  • All things Spriting
    • Important Sprite Creation Information.
    • Importing a Sprite To Visual Studios
  • Monobehaviour Documentation
    • BounceProjModifier
    • PierceProjModifier
    • KeyProjModifier
    • CompanionFollowPlayerBehaviour
  • Various Lists of IDs, Sounds, Etc.
    • List of Item and Gun IDs
    • Enemy Guids
    • List of Base Game Synergies
    • dfSpriteList
    • All Custom Ammo Types
    • Gun .Json Dump
  • OFF TOPIC MEMES
    • Modders Anthem
Powered by GitBook
On this page
  • Difficulty: 1/10
  • How to make a gun use a Continuous Fire Animation
  • Other Notes

Was this helpful?

  1. Making a Gun

Continuous Fire Animations

Explanation of how to make a gun use a continuous firing animation rather than a stop/start one.

PreviousAdding status effects to a projectileNextGun Ammo Types

Last updated 9 months ago

Was this helpful?

Difficulty: 1/10

By default, the shoot animation of a gun will return to its idle frame when it is finished, even if the fire button is held down. However, this isn't always what is desired, particularly with certain automatic weapons where returning to the idle frame looks awkward.

This is where Continuous Firing Animations come in. Guns with continuous firing animations will loop the specified section of their animation while firing, and return to the first frame of their fire animation upon the fire button being released. (this is also useful for guns that may have some sort of warmup animation when they start to fire, such as a gatling gun whose barrel spins slow at first but gets faster).

How to make a gun use a Continuous Fire Animation

  1. Set up the gun's sprites and animation the way you would normally do it to begin with.

  2. Make sure the bool 'usesContinuousFireAnimation' is set to true, like this;

gun.usesContinuousFireAnimation = true;

3. Now you need to set up a looped section in the gun's firing animation, which you can do by using the code below.

gun.GetComponent<tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).wrapMode = tk2dSpriteAnimationClip.WrapMode.LoopSection;
gun.GetComponent<tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).loopStart = 1;

Please note that the 'loopStart' variable is the frame on which the gun's animation will begin to loop. In this example, it is set to 1, but since computers count starting at 0, '1' actually refers to the second frame of the animation. For a loop to start on the first frame, 'loopStart' would have to be set to 0.

Other Notes

It is worth mentioning that upon the fire button being released, the gun will return to the first frame of its fire animation, not its idle one. To get around this, it may be advisable to set the first frame of the fire animation to the idle frame and start the loop on the second frame.

This way, the gun will still have a continuous looping firing animation, but will not persist on it's firing animation once firing has ended (or so it will appear to any end-user).