How to make an object aim to another?

Get help using Construct 2

Post » Sat May 06, 2017 4:26 am

I want my fireball, when created, to take the necessary angle to the nearest enemy, that makes part of the "bad" family.
How do I do it?
B
21
S
8
G
1
Posts: 29
Reputation: 2,000

Post » Sat May 06, 2017 4:46 am

you can use the turret behavior
B
25
S
16
G
26
Posts: 125
Reputation: 16,103

Post » Sat May 06, 2017 6:12 am

https://drive.google.com/open?id=0BzhJb ... Hh3OUdCMjQ did a quick mock up of what I think you are trying to do .capx is downloadable, hope this helps.
Image
B
47
S
17
G
3
Posts: 206
Reputation: 5,061

Post » Sat May 06, 2017 6:20 am

Also here is the code if ya don't wanna download anything.

Image
Image
B
47
S
17
G
3
Posts: 206
Reputation: 5,061

Post » Sat May 06, 2017 3:29 pm

VictoryX wrote:https://drive.google.com/open?id=0BzhJb0OhFHYkajdJMHh3OUdCMjQ did a quick mock up of what I think you are trying to do .capx is downloadable, hope this helps.

Hey bro, I made everything that is on the capx but even this way my fireball don't change its intial angle. What may be the problem?
Image
I want my dragon to spawn the firebbal in the frame "7" and shoot it on the nearest enemy (on the ground or in the air).
B
21
S
8
G
1
Posts: 29
Reputation: 2,000

Post » Mon May 08, 2017 12:01 pm

Event 49 does not pick a BolaFogo.
And, animation frame 7 will be displayed a few ticks in a row. Unless the animation speed = FPS, which is highly unlikely.

Give that dragon an instance variable 'target' (number). Set its value in the property s to -9.

In event 47 ....
Set the instance variable 'target' to the expression HumDragao.Turret.TargetUID

In event 47
Set the instance variable 'target' to - 9

In event 49
If you have 1 dragon, no dragon picking is need, else you got to pick the dragon.
But you have to pick the right target... so add the condition ....

BolaFogo > Pick by unique ID > .... ID = HumDragao.target

Add also a system > Trigger once while true ... else it will shoot out to many bullets. Because frame 7 is displayed more then 1 tick in a row.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu May 11, 2017 4:21 am

Thank you so much.
B
21
S
8
G
1
Posts: 29
Reputation: 2,000


Return to How do I....?

Who is online

Users browsing this forum: Cubeeo and 18 guests