MV Creating laser sight | Rotate picture "by angle"

I'm trying to create a simple laser sight effect, but it seems almost impossible considering you can't set picture's angle having zero as a starting point, only increase or decrease it by X degree.
Here's my not working script:
(I'm using Dcupu's Picture Alternative and Ozu's self variables, both work perfectly fine)

◆Script:window.v = $gameVariables._data
: :window.s = self(this)
◆Script:Speed = 20;
: :Game_Picture.prototype.initRotation = function() {
: : this._angle = 0;
: : this._rotationSpeed = 0;
: :};
: :Game_Picture.prototype.rotate = function(speed) {
: : this._rotationSpeed += speed;
: :};
: :Game_Picture.prototype.updateRotation = function() {
: : this._angle = (this._angle * (Speed - 1) + this._rotationSpeed) / Speed;
: :}; //Dcupu's Picture Alternative Plugin
◆Script:s["ROT2"] = 0
◆Script:s["ROT"] = 1
◆Script:s["rotY"] = 309;
: :s["rotX"] = 407; // Setting player's coordinates. He's always at the center of the screen
◆Show picture:#44, bullet1, Centro (309,407), (200%,200%), 255, Normal
◆Etiqueta:1
◆Wait:15 fotogramas
◆Script:var p1y = v[4]; var p2y = s["rotY"] // v[4] and v[3] are mouse's coordinates.
: :var p1x = v[3]; var p2x = s["rotX"]
: :s["ROT"] = Math.atan2(p2y - p1y, p2x - p1x) * 180 / Math.PI;
: :s["ROT"] = Math.round(s["ROT"])
: :s["ROT"] -= s["ROT2"] //trying to get the right angle by subtracting previous values (didn't work)
◆IF:Script:s["ROT2"] != s["ROT"]
: :$gameScreen.rotatePicture(44, s["ROT"]);
◆Script:s["ROT2"] = s["ROT"]
◆
:Fin
◆Ir a etiqueta:1

Getting the right angle between the mouse and player works perfectly fine, the problem is that my picture freaks out, getting wrong angles after a few "turns" or keep spinning.

UPD. Ok, I've almost figured it out
Added this instead
◆Si:Script:s["ROT2"] != s["ROT"]
◆Script:$gameScreen.rotatePicture(44, s["ROT"]);
◆Script:s["ROT2"] += s["ROT"]
◆
:Fin
do you have to use a picture? Especially considering how script-heavy you already are?

If I remember correctly pixi.js contains javascript commands to draw direct lines and other effects - there was a topic about that and how to use it several years back, but unfortunately I have no link or details because I never considered using it myself.
you'll have to search for the pixi documentation yourself.
aren't all origins 0 by default?
what do you mean you can't make an angle 0?
what do you mean you can't make an angle 0?
that is a limitation of the event command that can't set any angle at all, but only a rotation speed and that then greater than 0.
do you have to use a picture? Especially considering how script-heavy you already are?
I don't. I'll search around I guess.
that is a limitation of the event command that can't set any angle at all, but only a rotation speed and that then greater than 0.
....but if he's coding directly via script calls, what event command limitation are we talking about?

if you handle the sprite itself directly, *it* has a rotation and an anchor point.
it's much quicker to create a new class that contains a picture (sprite) than using pictures under the editor controls to mimic a sprite.

what you need is an origin, and an orientation.... AKA, a vector.
it having width, color and/or texture is of no consequence to it's base functionality: it must move following a parent object, and rotate pointing towards another object.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/creating-laser-sight-rotate-picture-by-angle.138416/