measure the vector X of a bullet

Get help using Construct 2

» Sat Apr 27, 2013 11:36 pm

hello friends, I want to know how to get the vector X of a bullet

Example:

If bullet.vectorX > 10 (do something)
If bullet.vectorX < 10 (do other thing)

I do not get where to put this condition . thanks

Luis Molina
B
44
S
9
G
10
Posts: 182
Reputation: 8,115

» Sun Apr 28, 2013 12:10 am

I was unable to find it :/, I think you want to know the Sped on the X axis, with the minus if it goes to the left, we can recreate the expression should be okay too:

Sprite.Bullet.Speed and Sprite.Bullet.AngleOfMotion will help us

(Sprite.Bullet.Speed * cos(Sprite.Bullet.AngleOfMotion))

and also VectorY is equal to:
(Sprite.Bullet.Speed * sin(Sprite.Bullet.AngleOfMotion))

Sprite is the name of your sprite

Tell me if I am wrongAphrodite2013-04-28 00:16:47
https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
41
S
16
G
15
Posts: 2,050
Reputation: 14,697

» Sun Apr 28, 2013 12:44 am

Your theory is good but only good for a bullet traveling on a fixed path.
In my case I need to know which way (left or right). a bullet of fire like mario bros type when you get a flower.

my bullet is constantly changing angle while ground bounces.

Thank you.

someone else wants to contribute to my question?
B
44
S
9
G
10
Posts: 182
Reputation: 8,115

» Sun Apr 28, 2013 12:56 am

[QUOTE=luisgmolina] Your theory is good but only good for a bullet traveling on a fixed path.
In my case I need to know which way (left or right). a bullet of fire like mario bros type when you get a flower.
[/QUOTE]

when the path changes, the formula is still valid I guess, and the VectorX I wrote is a negative number when going to the left, a positive when going to the right , and 0 if not travelling on the X axis(since the cosinus can be negative or positive or equal to 0 with the angle)

but still, this is a tricky formula, and I'm pretty sure a more understandable method can be foundAphrodite2013-04-28 00:59:31
https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
41
S
16
G
15
Posts: 2,050
Reputation: 14,697

» Sun Apr 28, 2013 1:22 am

I just want to know to which direction the bullet goes: left or right, I mean positive X or negative X

Left or Right
-X   or   +X

Thanks
B
44
S
9
G
10
Posts: 182
Reputation: 8,115

» Sun Apr 28, 2013 1:26 am

Work for me.

THANKS YOU!!!
B
44
S
9
G
10
Posts: 182
Reputation: 8,115