Help with turret behaviour

For questions about using Classic.

Post » Fri Mar 21, 2008 4:37 pm

Ah, I see. I've been tinkering around with it for a bit and I'm coming up with the same problem you're having. All of my homing bullets follow the first helicopter.

Maybe a new feature request for the Turret behavior? Like "Get Target UID?" Then you could do something like this, maybe:

+ Turret has target
- Turret: Spawn object Bullet
- Bullet: Set value('myTarget') to turret.TargetUID

+ Bullet: Value 'myTarget' Greater than 0
+ Group: Enemy Unique ID is bullet.Value('myTarget')
- Rotate 5 degrees toward Group: Enemy

Edit: Sweet Jesus, was I ever beaten. I've got to learn to check the thread again before hitting "submit." :oops:
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Mar 21, 2008 4:43 pm

ONE more question, sorry... is it possible to find whether a UID is valid? I'm just wondering what happens if a bullet is fired, but then the helicopter is destroyed by something else while the bullet is en route.

[code:sai1utxl]
+ For each helicopter
+ Bullet's variable = helicopter.UID
: Set angle toward helicopter
[/code:sai1utxl]

So here, obviously the "set angle toward helicopter" won't apply if the helicopter is gone, but is there a way to say "and if the helicopter UID is no longer valid, delete the bullet"?
B
2
S
1
G
5
Posts: 15
Reputation: 1,430

Post » Fri Mar 21, 2008 4:57 pm

Well, because the event won't run when the helicopter with intended UID is destroyed, you can use event logic something like this:

+ Always
: Bullet: set 'Is obsolete' to 1

+ For each helicopter
+ Bullet's variable = helicopter.UID
: Set angle toward helicopter
: Set 'Is obsolete' to 0

+ Bullet: 'Is obsolete' = 1
: Destroy bullet

And lol deadeye, great minds think alike hey ;)
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Fri Mar 21, 2008 5:06 pm

[quote="Ashley":14ijvncm]Well, because the event won't run when the helicopter with intended UID is destroyed, you can use event logic something like this:

+ Always
: Bullet: set 'Is obsolete' to 1

+ For each helicopter
+ Bullet's variable = helicopter.UID
: Set angle toward helicopter
: Set 'Is obsolete' to 0

+ Bullet: 'Is obsolete' = 1
: Destroy bullet

And lol deadeye, great minds think alike hey ;)[/quote:14ijvncm]

OK, thanks again everyone for their help.
B
2
S
1
G
5
Posts: 15
Reputation: 1,430

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests