How do I check for targets without turret behavior

Get help using Construct 2

Post » Mon Sep 18, 2017 3:31 pm

Guys, help is need so much.
I need to check for targets to attack it, but basic turret behavior doesn't suit for me (it's impossible to manage targets with complex conditions).

I solved this problem with "for each every tick" method, but it takes a lot of cpu work.
Are there up-to-dated addons (or solutions) with turret behavior but more advanced and optimized?
B
5
S
1
Posts: 31
Reputation: 441

Post » Mon Sep 18, 2017 10:23 pm

So you're looking for a way to do...what? Give me an example of a complex condition.
B
47
S
17
G
82
Posts: 2,231
Reputation: 48,609

Post » Tue Sep 19, 2017 3:28 am

B
40
S
23
G
83
Posts: 298
Reputation: 45,844

Post » Tue Sep 19, 2017 9:10 am

Message: fens can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
For example:
- I want use the same sprite for all units.
- Unit has team.
- Turret shouldn't target unit with same team value.

Turret behavior doesn't work in this way (link to capx)
https://drive.google.com/file/d/0B55PnHLHjkIGQ3lHRVRMNUsxUEU/view?usp=sharing

tarek2
Thank you, I never thought in this way, but it doesn't work if I have the same sprite for player and targets.
B
5
S
1
Posts: 31
Reputation: 441

Post » Tue Sep 19, 2017 9:50 am

In your example the target for the turret is the turret object itself.
As a result, "Unit->On Turret target acquired" event works unpredictably because most of the times turret acquires itself as a target and stops scanning for other targets. This is what's causing all kinds of problems.
And, I'm guessing, no "advanced turret" plugins will help here.

You need to create two objects - Unit1 and Unit2.
Set Unit1 as a target for Unit2 and vice versa.
Add them both into a Unit family, define all variables/behaviors/effects on the family and everywhere in your game you can continue to refer to Unit as one object. Only it will be a family instead of a sprite.
Check out my awesome game Doptrix
B
17
S
9
G
51
Posts: 849
Reputation: 28,507

Post » Tue Sep 19, 2017 11:55 am

- I want use the same sprite for all units.
- Unit has team, which i can change during game proccess.

Is it unsolvable problem?
B
5
S
1
Posts: 31
Reputation: 441

Post » Tue Sep 19, 2017 12:41 pm

With turret behavior and only one sprite object? Yes, I'm afraid it is unsolvable.

I still think you can use 2 sprite objects and a family. When one unit changes team, you create a new unit in another team, copy all its properties from the first unit and then destroy the first unit. Shouldn't be too hard.
Check out my awesome game Doptrix
B
17
S
9
G
51
Posts: 849
Reputation: 28,507

Post » Wed Sep 20, 2017 9:48 am

@fens

The way you wanna do it without Families and with one object will hurt performances a lot plus much more complicated but

Will this be good enough performance?

They don't shoot between the same teams, the teams are made of group of two

Capx: https://www.dropbox.com/s/5n9i79fey96pjmm/Team%20Pick%20No%20Famlies.capx?dl=0
B
40
S
23
G
83
Posts: 298
Reputation: 45,844

Post » Fri Sep 22, 2017 1:54 pm

Yeah, this is I've been looking for )
But it's same like: "I solved this problem with "for each every tick" method, but it takes a lot of cpu work."

Guys, I don't catch how I should work with families. I didn't found any actions with inheritance (only clone).
B
5
S
1
Posts: 31
Reputation: 441

Post » Fri Sep 22, 2017 1:59 pm

I really don't get why you must use the same object for both teams.

That said, you could get away with it by programming your own targeting behavior as funcytions and more specific conditions for targetting and shooting (every tick definitely won't cut it).

Cheers!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
20
S
6
G
3
Posts: 637
Reputation: 3,776

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests