measure the vector X of a bullet

0 favourites
  • 6 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • 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 <img src="smileys/smiley19.gif" border="0" align="middle" /> . thanks

    Luis Molina

  • 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

    your VectorX is equal to:

    (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 wrong

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    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 found

  • 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

  • Work for me.

    THANKS YOU!!! <img src="smileys/smiley1.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)