I am using the Gunman asset pack. It uses events to trigger sound effects and other things On a weapon such as shotgun there are f events, 2 sound effects, fire and eject casing. Only 2 of the events occur.
Using latest pull of 3.7 and default gunman asset pack.
Modify main.lua corona example line 84 and init with Idle
table.insert(skeletons, loadSkeleton("Gunman.atlas", "Gunman.json", 240, 300, 0.4, "Idle"))
Then at line 138 replace the key event listener code with
Runtime:addEventListener("key", function(event)
if activeSkeleton == 1 and event.phase == "down" then
state = skeletons[activeSkeleton].state
state:setAnimationByName(1, "Aim_Shotgun", false)
timer.performWithDelay( 500, function() state:setAnimationByName(1, "Fire_Shotgun", false) end )
end
return false
end)
When you trigger this you will see only two events
event: Fire_Shotgun, Sound, 0, 0, 'Pump/Random'
1 event: Fire_Shotgun, EjectCasing, 0, 0, ''
In experimenting I put the the Fire_Shotgun on a different track than Aim and I get all 4 events.
BUT, trigger it again, and only get 2.