Turret behavior problem...

Get help using Construct 2

Post » Wed Dec 23, 2015 6:17 pm

Hey, this is my second post :P
Well Im making a strategy game and I have a little (Huge) problem. I have some tanks and they shoot each other, thats what I want, but at the time when I put more than one kind of tank, the enemy tank starts getting a bit "crazy".
What do I mean? Well, I have tanks fighting 1 vs 1, "A" tank vs "B" tank, right, but when I put 2 vs 1, two "A" tanks vs one "B" tank, the "B" tank doesnt know who to shoot, it just stucks (Btw, the two "A" tanks are the same sprite, they're just duplicated, but they have their own hp, etc... )
Can pls someone help? I would apreciate it so much, Thanks! ^^
B
4
Posts: 17
Reputation: 232

Post » Wed Dec 23, 2015 7:55 pm

can you maybe change in the targeting to nearest target first or futherest target first. To see if there a difference ?
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Thu Dec 24, 2015 7:49 am

For a strategy game I would go a little further than just checking who's closest,
If it's an automated defense mechanism I would check which unit has the higher rank, which has the lowest health, which can cause you the most damage and target them accordingly.
Image
B
71
S
28
G
12
Posts: 515
Reputation: 12,284

Post » Thu Dec 24, 2015 10:37 am

Gearworkdragon wrote:can you maybe change in the targeting to nearest target first or futherest target first. To see if there a difference ?

No, I've already tried, it doesnt work...
B
4
Posts: 17
Reputation: 232

Post » Thu Dec 24, 2015 10:39 am

Lof wrote:For a strategy game I would go a little further than just checking who's closest,
If it's an automated defense mechanism I would check which unit has the higher rank, which has the lowest health, which can cause you the most damage and target them accordingly.

The problem is, the tank gets stuck because the two "A" tanks, are the same sprite, they're just duplicated, so there is when it gets stucks, cause when I have two different sprites, the "B" tank does not get stuck
B
4
Posts: 17
Reputation: 232

Post » Thu Dec 24, 2015 10:43 am

after you narrow down your pick to all tanks suitable for attack add a subevent with
pick nth instance (0)
and do the actions on it

if its still switching, maybe you need to lock your target until it dies or for a certain amount of time

add another var on your turret attackUID=0
now while it's 0 you're picking a tank, once you picked you're updating this value to the tank uid
than you need to reset it to 0 once the tank is destroyed or in any other condition you like.
Image
B
71
S
28
G
12
Posts: 515
Reputation: 12,284


Return to How do I....?

Who is online

Users browsing this forum: plinkie and 18 guests