Discord
Login
Community
DARK THEME

how do i make sprites rotate and arrows travel that same angle

please explain in simple monkey terms I do not understand sine and cosine

https://microstudio.io/i/Loginus/actoratan2bullet/

file >> main >> class Actor >> function draw() >>

    image.setRotation( this.angle )
    image.drawSprite( this.sword, 0, 30, this.sword.width, this.sword.height )
    image.setTranslation( 0, 0 )
    image.setRotation( 0 )

This code is responsible for drawing a sword rotated by a certain angle (the rotation point is in the center of the Actor).

When it is shot, the projectile remembers the current angle, then moves along the line that was created by the center of the Actor and the angle of the sword.

I now know how to rotate sprites but I still cant get it to move at the same angle

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community