I’m currently making a topdown shooter game with a camera angle and movement that is kinda exactly like Dead Town Zombie Survival. But instead of using touchscreen controls to rotate the player, I’ll be using a mouse instead (I’m not trying to make a ripoff though. I just got inspired by its camera angle and movement). I recently figured out how to put the camera angle in the same direction as the player, but I don’t know how to rotate the player with a mouse just like in DTZS. Any advice as to how to make the player rotate using a mouse?
I don’t know the game, but usually with mouse controls, the player rotates/aims towards the cursor.
To be honest, I want to rotate the player without the need of pointing him/her toward the mouse because I tried that. What happens is when I hovered the cursor to the other direction, the player never stops rotating until the cursor itself is placed in front of him/her. For me, I want the player to stop infinitely rotating once the mouse stops moving.
Well, if the player must stop rotating towards the cursor when the cursor is not moving, add a condition to make it happen.
You can store the cursor position, then compare it on the next frame. If it’s different, allow the player to rotate.
1 Like