[Behavior] jj_Weapon

0 favourites
From the Asset Store
Skin it
$14 USD
30% off
A skin plugin and behavior to add a skin system in your game.
  • Hey guys, I've been making some changes to the jj_Weapon behavior. Now I feel like the de-facto maintainer of this awesome extension :p

    I took the audacity to create a Github repository where I'll be uploading any new changes and releases of this and other behaviors I work on. You can download the latest version of everything here.

    And you're free to contribute by forking the repo

    The improvements in this version are:

    1. Support for multiple instances of the same weapon. In the original version it didn’t pick the right instance when shooting, so all bullets came from the same weapon.

    2. It triggers the on created event after spawning bullets.

    3. Added support to modify the stock size from event sheets.

    4. *NEW* It can save its state when required (implemented 'saveToJson' and 'loadFromJson' methods) this is very important to persist the state of the weapons.

    DOWNLOAD | Contribute

    IMPORTANT NOTE:

    This jj_Weapon is a derived work from JohnJ and I'll keep recognizing him as the original author of the extension.

  • JeyDotC

    Is it possible to not set a bullet instance? I mean, let the gun shoot but no object is created yet the number of bullets in clip reduces. As it is now, if you don't set a sprite as the bullet, and you fire the weapon, it results in a javascript error.

  • JeyDotC

    Is it possible to not set a bullet instance? I mean, let the gun shoot but no object is created yet the number of bullets in clip reduces. As it is now, if you don't set a sprite as the bullet, and you fire the weapon, it results in a javascript error.

    Let me see what I can do, I think that feature is actually necessary and will allow jj_weapon to be used for other timing control purposes

  • JeyDotC looking forward to it. Thanks

  • Hi all,

    I just made the Set bullet instance optional.

    Download

    | Source code

  • JeyDotC

    Awesome. Really useful change.

    Another thought I had, it is not something I need but I think the ability to set the number of bullets that would be shot on the 'on shoot' action would be a neat addition. As in, 'on shoot' > shoot X bullets. As it is you can't do a shotgun type weapon that shoots a set number of rounds at once.

    This might be a bigger task to implement I think.

  • There's a simple solution for that.

    Instead of making the shotgun shoot the shells at once:

    1. Create an invisible sprite, let's name it ShellSpread.

    2. Set several image points around that sprite.

    3. Listen to the on created event of the ShellSpread and create the needed shell instances at different image points.

    I use that trick on my template.

    BTW: One of the next things I will possibly do is to add a 'cancel reload' action, because switching weapons while reloading is causing me problems.

  • JeyDotC

    Thanks, will use that. Looking forward to the changes.

  • JeyDotC

    I have a small request. Is it possible to have an action that sets the 'shoot key' by keycode during gameplay? At the moment you can only set the shoot key via key keycode in the C2 editor. I need an option to set the shoot key during gameplay via keycode which can't be done at the moment.

  • Long time no posting things here. Just wanted to let you know, I added two new features to the behavior:

    • Added 'Set bullet instance by name' action which allows to set the bullet instance by passing the object type name.
    • Added the getLastShootTime expression that tells the last time the weapon was shot. I'm pending to add the condition.

    And there's a third work in progress feature: The cancel reload action which triggers the reload canceled event. The feature is implemented, but I haven't tested it yet.

    I'm doing this alpha release because I thought you could find it very useful to have the 'Set bullet instance by name' action.

    Download

    | Source code

  • Fine stuff. Thanks for the update.

  • JeyDotC Thanks son

  • Are you gonna port it to C3 as well? Your addon is just great..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Can't download from the given link... I know this post is very old but if someone can help out with a new link I'd be very grateful

  • Hello everyone, here's a new release of the jj_Weapon:

    github.com/JeyDotC/JeyDotc-C2-Extensions/releases/tag/1.0.3

    It basically makes setting weapon instance optional, allows to set the bullet instance by name and allows to cancel reload.

    I'll release it in the Addons site soon, with documentation and all:

    construct.net/construct-2/addons/88/jj-weapon

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)