0 Favourites

How do I set bullet angle of motion?

  • I am trying to fire bullets at various angles with respect to the player's angle to simulate a shotgun effect.

    If I simply spawn a bullet with set angle=yes, then it fires in the direction the player is facing. That's great but I would also like a bullet to fire 30 degrees off from that angle.

    I have tried:

    Spawn Bullet on layer 1

    Set Bullet angle of motion to player.Angle + 30 degrees

    I've tried it this way and in the opposite order. Neither does anything but fire the bullet in the player direction.

  • It works when I change 'Set angle' to No.

  • I am guessing that your bullets are not yet moving when you are setting the angle of motion ? If they have zero motion (velocity) then they cannot have an angle of motion. This was the explanation I got

    "The bullet's angle of motion is based on it's x and y velocity. If a bullet isn't moving then what is it's angle of motion? Think about it.

    And you have the bullet property 'set angle' = 'yes' - "Set the objects angle to the angle of motion".

    So when the bullet isn't moving, it's angle of motion = 0 and it's angle gets set to 0."

    This lesson was provided by ramones ...

    "But now I am the master!" (but only a master of evil ?) mmmmmwwwwahahahahahaha

    (Sorry, it's early and I am still on my first coffee and have not had my anti-silly pills yet)

  • Yeah. I had 'set angle' set to Yes.

    When I changed it to No it worked. Prior to that I was setting the angle before and after the bullet spawn but neither worked.

    Thanks for the insight

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • For the "set angle of motion" action to work, you need to first set the speed of movement > 0.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,152
karshinkoff's avatar
karshinkoff
Unread hot topic
88 9,245
goldentreee's avatar
goldentreee
Unread hot topic
56 4,735
MPPlantOfficial's avatar
MPPlantOfficial