How do I add specific UID as turret's target?

Get help using Construct 2

Post » Wed Dec 16, 2015 11:15 am

I want to add turret target by comparing target's instance variable, not all the object type. Is there a workaround for this? I did a customize turret action using for loop for turret rotation but it has negative impact CPU usage.
B
16
S
4
G
1
Posts: 203
Reputation: 1,558

Post » Wed Dec 16, 2015 8:38 pm

What do you wan't to do exactly ? You want your turrets to choose a specific target according to certain instance variables ?
In this case a for loop with hundreds of objects would not cause a heavy cpu usage if you do it correctly.

Can you provide a little capx ?
B
14
S
4
Posts: 109
Reputation: 1,281

Post » Wed Dec 16, 2015 11:51 pm

B
16
S
4
G
1
Posts: 203
Reputation: 1,558

Post » Thu Dec 17, 2015 12:24 am

Add a condition that checks against an instance variable? i.e. on start of layout (if player.health = 100) > then add target player.
B
43
S
13
G
59
Posts: 1,779
Reputation: 35,731

Post » Thu Dec 17, 2015 9:42 am

yes,this is the template. Apparently the For loop is slowing down the whole game. 90 percent CPU usage for 150 units on map.
B
16
S
4
G
1
Posts: 203
Reputation: 1,558

Post » Sat Dec 19, 2015 9:34 pm

You gave a link to an image. By capx i meant the file .capx of your project or a more simple one so I can make some changes, maybe find a solution, and give it back to you, so you can compare.

For now, I don't know what's the cause of the slowdown. In construct 2, slowdowns are commonly due to objects having too much behaviors at the same time that check for collisions. So for hundreds of objects you can have thousands of collisions checks per seconds.
B
14
S
4
Posts: 109
Reputation: 1,281


Return to How do I....?

Who is online

Users browsing this forum: Phacanu and 11 guests