08-11-2022, 12:19 AM
I didn't fine tune it but this will make the player chase the mouse pointer in any direction. (I didn't clean up the rest of the mouse code). Helpful?
Code: (Select All)
dy = 0
dx = 0
If mousey < player.y + camera.y - 5 Then dy = -1
If mousey > player.y + camera.y + 5 Then dy = 1
If mousex < player.x + camera.x - 5 Then dx = -1
If mousex > player.x + camera.x + 5 Then dx = 1
If dy = -1 And st = 0 Then player.y = player.y - (playerSpeed / 2): t = t + 1
If dy = 1 And st = 0 Then player.y = player.y + (playerSpeed / 2): t = t + 1
If dx = -1 And st = 0 Then player.x = player.x - (playerSpeed / 2): t = t + 1
If dx = 1 And st = 0 Then player.x = player.x + (playerSpeed / 2): t = t + 1