How can I get the direction on sprit . #699
Unanswered
jamtechdev
asked this question in
Q&A
Replies: 1 comment
-
You can set the rotation, and move forward towards the angle with const rocket = add([
pos(100, 100),
sprite("rocket"),
// set the angle to what you want
rotate(100),
])
function moveForward(rocket, distance) {
// you might want use `rocket.angle + 90 * n` based on the original rotation of your rocket image
rocket.moveBy(Vec2.fromAngle(rocket.angle).scale(distance))
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a rocket image and I'm swamping it in random positions on the screen now the problem or I'm not getting how I can turn the angle of the rocket pointer in the direction in which it's moving. Suppose the rocket is swamped on the left side of the screen and moving in the right direction then I need to make the direction on the rocket point in the right direction.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions