Bullet Direction, Trigonometric Functions, and atan

0 favourites
  • 3 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • I'm using atan to set the angle for a bullet. Unfortunately, it isn't behaving the way I expect. I thought that by determining the difference in x values of the target and the origin (and doing the same with the y values) I could get the opposite and adjacent sides of a triangle. From that I should be able to use atan to get an angle that references north as the 0/360 degree point. I then thought I could just subtract 90 degrees from that angle to orient the angle to Construct 2's technique of using east as the 0/360 degree point.

    Well, this isn't working. My bullets seem to be going in the opposite direction they should be going. I've tried adding 180 and 270 degrees to see if that would have an affect, but it's not doing what I need it to do.

    Before going down this path, I thought there'd be some action that would just let me launch a bullet towards an x,y coordinate, but I didn't see one.

    Anybody know the solution?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That was a looong text. should just have read the last two lines

    There is a action called "Set angle towards position" you can use that.

    Something like this:

    https://dl.dropboxusercontent.com/u/2560922/mobiledev/forum/setAngleTowardsPosition.capx

  • It never occurred to me to look outside the bullet behavior for an action that would make this happen. Thanks for the help.

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