How do I Get enemies to shoot randomly not at the same time

0 favourites
  • 4 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • All enemies are assigned a bullet behavioir. I have it set so that every random 2-5 seconds the enemies change bullet angle and speed, but instead of each one using their own random value, they all change angle and direction at the same time. Ive had problems with this trying to get enemies to shooot at different times, but I can't figure out how to give each enemy a random timer. I also tried assigning each enemy a timer, and used For Each statements, but nothing works. Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is a timer behaviour you could attach to the object.

    However, you also mention they all have to change at the same time then you could either

    1. set a variable which is subtracted from each tick e.g.., MyTime subtract by (10*dt)

    2. set a timer to a dummy object and when that fires loop through all your oibjects and set the new angles etc

  • I do want them to all act differently, and not off of the same timer. hmmmm i tried having a timer object to the character, but it didnt work. Maybe i did it wrong

  • I would simply set a instance variable for each object and when it is less than zero do the action and reset the variable. Each tick or every 0.5 seconds reduce the variable with an amount that is appropriate. i.e., either dt or a fixed time

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