How do I set random fire rates?

0 favourites
  • 5 posts
From the Asset Store
*********** Fidget popper tile sets **************
  • This one is kind of embarrassing because I'm certain I should be able to do it myself by now but I'm finding it difficult. All I want to do is set each instance of an enemy to fire when certain conditions are met (line of sight to player, is on-screen, is visible etc) at a randomly determined rate and have this rate change after each shot. Currently, it seems I can't do this without all instances firing at the same rate, even when I try setting that rate as an instance variable.

    Can anyone help or point me at a relevant tutorial?

    Many thanks in advance.

  • Here's one approach

    System > Every Choose(1.0,2.0,3.0) > Sprite >Set Bullet Speed to choose(100,150,200)

    The sprite is the actual bullet. Choose works well but, you could use Random and replace "System" with the conditions that you want. In this example we're also changing the speed of the bullet.

    Hope this helps.

  • Ah, sorry, I meant the delay before they fire their next projectile, not the speed of the projectile.

    At the moment I have something like this:

    Enemy > Has line of sight

    System > Every Random(1,5) Seconds >>> Enemy > Fire Projectile

    The problem is that I can't seem to get each separate enemy instance to fire at a different random rate.

  • else

    You could use the Timer behaviour for each enemy

    [attachment=0:13aqpclx][/attachment:13aqpclx]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, thanks so much! That looks perfect.

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