Edit: MathWizz gave me the solution! Thank you:
Solved problem:
I'm making a game that scrolls on the X and Y axis. It will have turrets that shoot at the player. The projectiles need to be able to move in the correct direction, but they must do so by changing an xoffset and yoffset variable instead of saying move [x] steps
What would be the math that converts direction into an x and y change?
Last edited by Billybob-Mario (2012-07-18 19:14:19)
Offline
MathWizz wrote:
forever change x by ([sin v] of ((angle)*[x])) change y by ([cos v] of ((angle) * [x])) end
Move x steps translates into this.
So if you want to move 10 steps replace x with 10.
Offline
Wes64 wrote:
MathWizz wrote:
forever change x by ([sin v] of ((angle)*[x])) change y by ([cos v] of ((angle) * [x])) endMove x steps translates into this.
So if you want to move 10 steps replace x with 10.
Oh, derp. You still got it wrong though.
forever change x by (([sin v] of (angle))*(x)) change y by (([cos v] of (angle))*(x)) end
Last edited by MathWizz (2012-07-18 19:11:19)
Offline
MathWizz wrote:
forever change x by ([sin v] of (angle)) change y by ([cos v] of (angle)) end
Thank you! It works!
Offline
Why can't you use the move block? And if it's because you don't want the direction to change, how about locking the rotation style? http://wiki.scratch.mit.edu/wiki/Rotation_Style Just a thought.
Last edited by Hardmath123 (2012-07-18 21:42:20)
Offline