How do I sent angle of bullet towards Hero?

Get help using Construct 2

Post » Sun Nov 20, 2016 7:50 am

Greetings there! ^_^
So basically, i want; - When Hero is in line of sight of X - (X is bullet with 0 speed currently) - then set speed to 1000 and 'shoot' towards Hero. Whether Hero is behind or in front, it should shoot towards the Heroes position.

Whether the Hero is jumping or ducking, it should always aim at the Hero. When i set its angle of motion towards Hero, it keeps going to the right?

So how to do this?

Thanks in advance! ^_^
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Sun Nov 20, 2016 10:08 am

(If "Hero" is in line of sight) - "X" set speed 1000
- "X" rotate towards position "Hero.X" "Hero.Y"

These comands will be repeated each tick the Hero is in the line of sight of the bullet.

I don't know how to detect line of sight, but the rest should work
ImageImageImageImage
B
30
S
9
G
7
Posts: 262
Reputation: 5,646

Post » Sun Nov 20, 2016 1:23 pm

TRMG wrote:(If "Hero" is in line of sight) - "X" set speed 1000
- "X" rotate towards position "Hero.X" "Hero.Y"

These comands will be repeated each tick the Hero is in the line of sight of the bullet.

I don't know how to detect line of sight, but the rest should work


Line of sight is fine, but i cant get the rotation, what u mentioned, the bullet moves only left or right, so if the Hero jumps, it will go under and pass lol.

Basically, i want when 'Hero is in line of sight' (works fine) - Get object X to move towards Hero. Maybe bullet is not the right way? So far the bullet has 0 speed, but when it has 'line of sight' of Hero, the bullet gains 1000 speed to move rapidly to the Hero, but it keeps going left and right, i cant get it to 'follow' the hero.
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Sun Nov 20, 2016 10:05 pm

Greaver wrote:
TRMG wrote:(If "Hero" is in line of sight) - "X" set speed 1000
- "X" rotate towards position "Hero.X" "Hero.Y"

These comands will be repeated each tick the Hero is in the line of sight of the bullet.

I don't know how to detect line of sight, but the rest should work


Line of sight is fine, but i cant get the rotation, what u mentioned, the bullet moves only left or right, so if the Hero jumps, it will go under and pass lol.

Basically, i want when 'Hero is in line of sight' (works fine) - Get object X to move towards Hero. Maybe bullet is not the right way? So far the bullet has 0 speed, but when it has 'line of sight' of Hero, the bullet gains 1000 speed to move rapidly to the Hero, but it keeps going left and right, i cant get it to 'follow' the hero.

Oh, then add an instance variable to X, which would get set to 1 when the hero is in line of sight, and then make it so when the instance variable is 1 => "X" set speed 1000 and "X" rotate towards position "Hero.X" "Hero.Y"
ImageImageImageImage
B
30
S
9
G
7
Posts: 262
Reputation: 5,646


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests