Hello
I am coding a small bot/script for a TOP-DOWN 2D browser game, in JAVASCRIPT...
Actually I got prety nice work done, like:
- Movement (but without angle...)
- Auto teleport /party / heal, etc...
- Restart bot/script when server restart
- Read command from ADMIN(me) through chat
But... I am really bad with maths (i guess this thing about angle is all about maths)...
Hopefuly can get yours help
So here goes the question:
How to get correct ANGLE, so I (P1) face Target (P2(), knowing only:
*- P1 X and Y
*- P2 X and Y
My objective:
Is to make player follow target, facing it.
It work moving backwards, forwards and sidewards, but I want to make player follow the target, moving forward (so it needs to be facing it)
A simple draw...
P1 is currently facing 0º
I want P1 to face something like 20º