How do I Add a Kill X enemies in Y Seconds Objective

0 favourites
  • 4 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I'm currently adding objectives to a game I'm working on. I want to add some which require you to kill a certain amount of enemies within a certain time period, The issue is that any killed enemy could be the 1st, 4th, 9th etc. enemy in the successful chain. So how do I keep track of the multiple different sets of kills all at once to check whether they were completed in the time period. I apologise about this explanation being a bit iffy but I'm struggling to put down what I mean into words.

    Thanks!

  • Have you tried using a global variable and adding 1 to it every time the player gets a kill within the alloted time period?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried using a global variable and adding 1 to it every time the player gets a kill within the alloted time period?

    I have no problem with counting the amount of enemies killed, the difficulty is checking whether each string of X kills took place within the given time limit

  • Have another variable isWithinObjectiveTime which is set to 1 as soon as the objective starts, and set it to 0 after the objective time has ellapsed. You can do something like this

    And then add a condition to check if isWithinObjectiveTime is 1 in the event that checks for a kill.

    I'm guessing you want to have multiple objectives at the same time. In that case, you should create an 'Objective' object, have objectiveTime and isWithinObjectiveTime as instance variables, and try using the timer behavior (which does the same thing as Every X seconds, but on an individual level for each object

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