This page contains some details about what the different parts of the weapon XML mean and how to change them. You should be at least somewhat familiar with XML format to continue.
In the first section you have the asset title of the weapon and some attributes:
<gunAppWeapon name="drawnGun" allowInterrupt="true" allowSoundOverlap="true">
allowInterrupt lets GunApp know whether the animations of this weapon should be forced to complete before allowing other animations... for example when you click on most of the hand guns, usually you can tap-tap-tap and they go blam-blam-blam, that's allowInterrupt ="true". On other weapons such as the hairspray flamethrower, if you tap-tap-tap the weapon won't react if an animation is already playing. For the user input to cause it to change the weapon has to be idling; this is allowInterrupt ="false". Burst, reload, and intro animations are always false, and can never be interrupted.
allowSoundOverlap tells GunApp whether sounds for this weapon should be cut off between animations. Usually you want this to true. An example where you would want false is if your sound is very long and your animations very short, in which case the sounds would overlap too much and possibly create a cacophany of sounds.
The following section can be used to spawn particles around during your animations, this is how many visual effects in GunApp are created. In the 'emitters' section you establish what emitters should exist for the weapon. Then in the 'frame' sections you can call on the emitters you set here to emit.
id is a number assigned to the emitter, you can use this later for calling spawns from it, id's should be in order and not duplicated or skipped.
name is the file name of the emitter image, in this case the file name is drawnGun.projectile.png
blend 1=none(draw the whole quad) 2=transparent 3=add 4=multiply... having any other values will crash GunApp.
This is how to draw the emitter. 2 means alpha blending (use transparency):
<emitters> <emitter id="0" name="drawnGun.projectile" blend="2" /> </emitters>
The following can be set to allow/disallow certain firing modes. SwitchPosX and SwitchPosY sets the location of the switch button on the screen in pixels from the top left of the screen. Make sure you have at least 1 enabled!
<shotTypes switchPosX="412" switchPosY="250"> <single>0</single> <burst>1</burst> <auto>1</auto> </shotTypes>
In the weapon XML you will an 'animations' section, and in that section you will find the animations and frames that move the weapon around on the screen. Here are all the recognized animations and how GunApp uses them:
|intro||This animation that will play only once, and only on the first input. It's first frame will be used to start and is useful for setting an initial state (see lightsaber)|
|firstShot||if it exists, this will be the first animation to play during a finger down if gunapp is in single or auto firing modes.|
|shot1, shot2, shot3 ... 8||used during single shot, and auto fire modes. Chosen randomly.|
|lastShot||if the weapon has ammo, this will play as the final round is used instead of a shot1,2,3 (see m1garand)|
|windDown||if this exists it will occur after any single firing or auto firing on finger up. This does not play in burst mode. (see minigun)|
|burst1, burst2, burst3... 8||these play exclusively in burst firing mode, and are chosen randomly.|
|reload||this animation will play only if there are bullets defined for the weapon. (the user swipes down to reload)|
|idle1, idle2, idle3... 8||when there is nothing else playing, gunapp will randomly choose between these.|
in an animation 'frame' you might see 'spawn' :
<frame n="2" x="-55.64475118" y="-29.10839721" rot="2.35000885" img="1"> <spawn e="0" n="1" x="389.197589" y="62.14687252" ms="400" sc="30" rMn="0" rMx="0" iRot="0" ang="-0" rg="0" gX="0" gY="0" sp="0.3" fr="0" /> </frame>
Spawn means spawn a particle on this frame. There can be multiple spawns on a single frame.
|e||what emitter to use (defined in 'emitters' at top of XML)|
|n||number of particles to spawn from this emitter|
|x||x position spawn of the particle, keep in mind the coord is upper left of the particle|
|y||y position spawn of the particle, keep in mind the coord is upper left of the particle|
|ms||duration of the particle, in milliseconds. It will start to fade as this time is reached|
|sc||scale of the particle, in pixels|
|rMn||rotation spin minimum|
|rMx||rotation spin maximum (GunApp will choose a random rate between min/max every time this particle is spawned by this frame)|
|iRot||the starting angle that the particle will spawn at. NOTE that the rotation pivot is at the center of the particle image, unlike it's position coordinate which is at it's upper left|
|ang||this is the angle at which the particle movement is directed (if it has speed, if speed is 0 this has no effect).|
|rg||direction range. This is a randomized offset used to allow a particle to 'spray'. For example a laser firing would have a range of 0 (any spawned particles will strictly use the 'ang' value), but a hose might have a value of 30 degrees ( in which case GunApp will choose randomly between -15 and 15 from 'ang').|
|gX||gravity X. This can be used to have the particle fall left or right.|
|gY||gravity Y. This can be used to have the particle fall upwards or downwards.|
|sp||speed. How fast does the particle move when it is spawned.|
|fr||friction. Slows movement of the particle down each frame, use this to set how fast does it slow it's movement.|
On a <frame> you might also see a 'netSend' attribute. netSend is the call to send a network message to other devices running GunApp so that we can have multiplayer impact effects. The message will be sent any time this frame is played. You can add netSend to any frame you want, but be careful not to send these very often as to not flood your network. Here is a chart that maps what number corresponds to what impact effect.
|7||artiller/mortar incoming hit|
|8||screen shatter (like from a bomb)|
|10||physical hits to screen|
|11||very hard, crushing hits to screen|
|40||sizzle with some smoke|
|41||hard electrical hit|