Rounding a bullet angle from a non rounded angle source?

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

    I have bullets being fired from a cannon, the cannon is a pre-drawn isometric sprite and its 40 animation frames are at 9 degree increments, the angle is set from a seperate rotating "pointer" sprite as such :

    set cannon animation frame to round(Pointer.Angle /9)

    I want to fire a bullet at the same 9 degree increment to match the cannon frame angle.

    setting the bullet angle to


    works OK, but the angle obviously isnt rounded.

    setting the bullet angle to

    round(Pointer.Angle /9)

    doesn't work..

    Can anyone tell me where I am going wrong?

    Thanks in advance..

  • Not sure what you mean by "rounded angle".

    Here is a simple method - define two image points on each frame:

    Then do this:

    Cannon spawn Bullet at image point 2

    Bullet set angle to angle(Cannon.ImagePointX(1), Cannon.ImagePointY(1), Cannon.ImagePointX(2), Cannon.ImagePointX(2))

    Bullets will shoot in the direction from image point 1 to image point 2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000

    Thanks for your response!

    By rounded angle, I mean using the ROUND function to round the angle to the nearest 9 degree increment..

    That's a nice simple method but I have 40 frames in isometric - I guess if I can't get any more suggestions I will go with that, but it's a lot of work compared to code..

  • Rounding rounds a number to the nearest integer, not to nearest 9 degrees

    Try this formula:

    bulletAngle = round(Pointer.Angle /9)*9

  • Thankyou so much, you just saved me a long evening of correctly placing 80+ image points!

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