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.
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.
Develop games in your browser. Powerful, performant & highly capable.
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!