SpyCoderX SpyCoderX loading

90999988 wrote:

Hi! Small creators like me feel free to use this to help. But thats not the reason i created this.
How do i create smooth pointing at the mouse pointer?
Heres the code that doesnt work.
when green flag clicked
forever
point towards [Mouse pointer v]
Well, there is this method to turn at a fixed rate:
Credit: RokCoder
define Turn towards mouse
set [current direction v] to (direction)
point towards [mouse v]
set [target direction v] to (direction)
set [delta direction v] to (((((target direction) - (current direction)) + (180)) mod (360)) - (180))
if <([abs v] of (delta direction)) < (rotation speed*)> then // *rotation speed is the speed at which you want to turn towards the mouse pointer
point in direction (target direction)
else
point in direction ((current direction) + (((delta direction) / ([abs v] of (delta direction))) * (rotation speed*)))
end

You can also use this to turn a certain % at a time:
define Turn towards mouse
set [current direction v] to (direction)
point towards [mouse v]
set [target direction v] to (direction)
set [delta direction v] to ((((((target direction) - (current direction)) + (180)) mod (360)) - (180)) + (current direction))
point in direction (((current direction) * ((1)-(rotation percent*))) + ((delta direction) * (rotation percent*))) //Rotation percent* is a value between 0 and 1