Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Need help with weapon.autofire


erest0r
 Share

Recommended Posts

Actually what you have to do is to start the "first" fire by yourself with a "weapon.fire();". Then if the autofire is set to "true", the weapon will fire again depending on the "weapon.fireRate".

Link to comment
Share on other sites

It took me a little time to figure it out but now I have the solution ! Actually the way "autofire" works is pretty weird but it makes sense somehow... To make it work you have to :

- Set your "weapon.fireRate" in the "create" function, for example set it to 1000 to have a new shot each 1000 ms (1 s)

- Set "weapon.autofire" to true, in the "create" function

- Then in the "update" function, you have to put a weapon.fire(); And what will happen next is that the weapon will only shoot each 1000 ms (1 s).

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...