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

Get help using Construct 2

Post » Fri Jun 20, 2014 11:26 pm

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!
B
23
S
4
G
1
Posts: 71
Reputation: 8,346

Post » Fri Jun 20, 2014 11:29 pm

Have you tried using a global variable and adding 1 to it every time the player gets a kill within the alloted time period?
B
6
S
2
Posts: 79
Reputation: 608

Post » Fri Jun 20, 2014 11:32 pm

monitz87 wrote: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
B
23
S
4
G
1
Posts: 71
Reputation: 8,346

Post » Fri Jun 20, 2014 11:43 pm

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

Image

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
B
6
S
2
Posts: 79
Reputation: 608


Return to How do I....?

Who is online

Users browsing this forum: max2612 and 4 guests