How do I make bullet fire in random time by many shooter

0 favourites
  • 6 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • i have a bullet(just a single sprite) used by many villains shoooting my player. now, in my condition they fire up in every 2 seconds(so all the villains shoot bullet same time). now, how do i make the bullet of each villain fire in random? im thinking about using different bullet sprite for every viillain so i can control how much time they should fire per x second in random

  • You can have random 'reload' and firing times by doing this:

    Add the Timer behavior to your villains (enemies)

    On start of Layout:

    ---> Enemy: Start Timer "fire" for random(1,3) (regular)

    On Timer "fire":

    ---> System: Create object "bullet" on layer 0 at (enemy.X, enemy.Y)

    This will make them shoot a bullet every 1 to 3 seconds.

    I hope this helps!

  • You can also make a condition like this:

    - Every [random(0.5,2)] seconds
    [ul]
    	[li]For each Villain[/li]
    [/ul]          --> Shoot bullet[/code:wbitwzwc]
    
    This will fire each Villain's gun at random times.
    The "for each" causes a random time to be created for every instance of a villain again.
    
    If you want every villain to shoot exactly every 2 second, but at different times,
    choose this:
    [code:wbitwzwc]- Every 2 seconds
    [ul]
    	[li]For each Villain[/li]
    [/ul]        --> Wait [random(0.5,2)] seconds
            --> Shoot bullet[/code:wbitwzwc]
  • You can have random 'reload' and firing times by doing this:

    Add the Timer behavior to your villains (enemies)

    On start of Layout:

    ---> Enemy: Start Timer "fire" for random(1,3) (regular)

    On Timer "fire":

    ---> System: Create object "bullet" on layer 0 at (enemy.X, enemy.Y)

    This will make them shoot a bullet every 1 to 3 seconds.

    I hope this helps!

    -> set object time scale?

    • How to set timer?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can also make a condition like this:

    - Every [random(0.5,2)] seconds
    - For each Villain
              --> Shoot bullet[/code:2xo7drz1]
    
    This will fire each Villain's gun at random times.
    The "for each" causes a random time to be created for every instance of a villain again.
    
    If you want every villain to shoot exactly every 2 second, but at different times,
    choose this:
    [code:2xo7drz1]- Every 2 seconds
    - For each Villain
            --> Wait [random(0.5,2)] seconds
            --> Shoot bullet[/code:2xo7drz1]
    

    is

    Every [random(0.5,2)] seconds[/code:2xo7drz1] an event with blank action and [code:2xo7drz1]For each Villain[/code:2xo7drz1] an event with [code:2xo7drz1] Shoot bullet [/code:2xo7drz1]  action
  • You can have random 'reload' and firing times by doing this:

    Add the Timer behavior to your villains (enemies)

    On start of Layout:

    ---> Enemy: Start Timer "fire" for random(1,3) (regular)

    On Timer "fire":

    ---> System: Create object "bullet" on layer 0 at (enemy.X, enemy.Y)

    This will make them shoot a bullet every 1 to 3 seconds.

    I hope this helps!

    I re read your comment! iunderstand now its working! thanks

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