Help creating a reload for a gun :D

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I'm making a simple shotgun and everything's gone great,

    I just have 1 little issue at the moment,

    I have it set to when the shotgun shoots it sets P variable R to 1.

    When R is set to 1, I want to make it wait X seconds before switching back to 0.

    For some reason I cant find a time set up like that that isn't in form of a condition..

    Help would highly be appreciated!

  • Add a "Wait" object to your project. If you can't see the "wait" object, make sure that you have the latest build of Construct.

    Afterwards, just call the "wait" object inside the event sheet, then select "aWaitDelay"

    This should help you in placing a delay in your game.

    Hope this helps.

  • Oh!

    I never would have thought to check out the object

    Edit:

    When I use this,

    It works perfect the first shot,

    then the rest go back to rapid fire..

    any clues to why it does that?

  • Hmm... That's weird. It should work. You must have placed the delay somewhere that it isn't called again. Check the flow of your code and see if it passes through the function with your delay the second time around.

    Tip: Check if your conditional is met. You might have forgotten to re-set a value to meet the condition.

  • Use the timer behavior.

    Here's an example to illustrate:

    http://dl.dropbox.com/u/5426011/example ... xample.cap

  • I love this forum

    Thanks a lot hound!

  • Ehh why not just use every x milliseconds? From what I've heard it's the simplest answer. Just have when button down & every (lets say 500) MS > shoot

    That way you can shoot 2 times a sec and if you want slower just increase the millisecond count or so.

  • Sagal's right, just use the "every" condition, much simpler. I compared the two methods and found that they behaved pretty much the same. I'm continuously impressed on how so many tasks are very simple to do in construct.

  • Yes, I was going to propose to use the every x milliseconds too, but kithief said he wasn't looking for a method that isn't a condition.

    rojohound, I agree. Construct <3

  • Ohhh good idea!

    much appreciated

  • Of course if you need to do real reload system: press "R" wait 5 sec then mag is full is a bit more complex needing 2 PVs (except if someone has better idea how to do it) In short:

    Press R set pv1 to 1

    When pv1 is 1

    Every 500 MS

    add 1 to pv2

    When pv2 is 5000

    Set pv1 to 0

    Set pv2 to 0

    Set bullet (pv too) to lets say 30

    I've been wondering is there an easier way of doing? (Not counting just modified version where you eliminate pv2 by adding bullets) oh and ofc you prevent shooting when reloading (by having cond= pv1 is 0)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's fairly simple Sagal. Presumably you want it so that it reloads bullet by bullet, but the player can interrupt the reloading by shooting, using on of the reloaded bullets?

    So yeah, 2 pvs - 1 : isReloading, 2 : currentBullets

    easy business

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