How do I set a bullet angle relative to my character

0 favourites
  • 4 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • Hello everyone,

    I'm quite new to construct2 and I've the feeling mine could be a very trivial question. The main character in my game is a boat equipped with two cannons mounted at an angle of 45 degrees (+45 and -45 to the boat direction).

    I would like my boat to shoot a cannonball at the given angles on mouse click. I've added two image points (one per cannon) and added the corresponding spawn event. Together with the spawn action I've also added to my 'cannonball' object a set angle of motion action. I set the angle to:

    Ship.Angle + 45

    (Ship is my character)

    However, when I'm running the game the bullet is not considering the 45 extra degrees I've added. The bullet is following the boat direction (I don't know if it is relevant, but it has a car behavior) but is not applying the angle.

    Could you please help me?

    Thanks in advance to anyone answering.

  • If I understand you correctly then just give your Cannonball "When clicked - set bullet angle towards Mouse.X, Mouse.Y

    I guess =P

    Hope it helps

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The moment that you spawn the bullet, it is not moving yet.

    The bullet acts like a car-in-reality.

    When the car stands still, turning steer will not change the direction of the car.

    Setting angle of motion action is like steering the bullet.

    But, the angle of motion aligns to the actual angle of the bullet, when the bullet is not moving.

    Same is true for the car, re position it with a forklift, and you can change its direction while it is not driving.

    So ...

    Spawn the bullet.

    Set its angle to ship.angle +- 45 (sprite > Set angle)

  • Thanks 99Instances2Go, that worked perfectly.

    Thanks for your explanation as well, now the mechanism is much clearer to me.

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