How do I make automatic reloading!

0 favourites
  • 6 posts
From the Asset Store
Save hours of work by resizing items on your game screens.
  • I'm using turret behavior with a machine gun that acquires an object when i click it, rotate to it and fire.

    now I'm trying to make an automatic reload system that reloads a new bullet every 2 secs but not while the machine gun is shooting (no shooting and reloading at the same time, reloading should begin after 2 secs from stop shooting)

    i can't find a condition (is shooting) that makes the condition true while shooting, instead there is (on shoot) condition and triggered once. so i tried using the condition (if bullet is on screen) as a work around.

    i tried (every 2 secs + bullet isn't on screen ----> add 1 to ammo) but reloading starts immediately after stop shooting and continue every 2 secs or may be something else is wrong about timing.

    how can i solve this ?

    Hope I explained my problem correctly but to give a clear example for what i mean : "Swamp attack" reloading system

    Thank you.

  • Perhaps you could use a timer? Whenever you shoot, reset the timer. If the timer ever finishes, that means that you have stopped shooting.

  • I've to set the value of this timer, what value should i use ? how many secs ?

  • I would make a timer like this first; It counts from 2 to 0 and when it hits 0 it returns to 2 again and so on.

    Then, I would give a value to turret or I would use a global variable.

    Then;

    1- When timer hits 0

    2- Animation is not playing shoot

    OR

    I'd prefer "not at shoot stance" (like when it's at 1 turret can shoot, when it's at 0 turret can't shoot)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, you said [quote:1nbdyw6d]reloading should begin after 2 secs from stop shooting

    so I think 2 seconds would be a good starting point. You might add in a little extra time, to be sure that the target has been lost.

  • I'll give it a try, thanks for help

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