Basically im trying to make a top down shooter, but i would like to keep the mouse within an area. What i plan to do is when the mouse leaves the area, i would get back the cords of the exit point and warp the mouse back, creating the illusion of a mouse limit. I just think i would look better to have a aiming area in the level then to have a curser that can move anywhere on screen IDK. also if you can't already tell, im a noob, so sry if this seems stupid, but i can't find a tutorial that "fixes" this issue. I was also trying to see if i could use lengths between the player and the mouse to make a circle with a maxlen..... here ill just post the code
extends KinematicBody2D
export var can_move = false
var location = Vector2.ZERO
func physicsprocess(delta):
var mousepos = getglobalmouseposition()
var playerpos = position
var mousedistance = Vector2(mousepos.x - playerpos.x, mousepos.y - playerpos.y).length()
if mouse_distance > 350:
Input.warp_mouse_position(player_pos)
I want to replace the player_pos in the line above with the location of the "exit point"
thx in advance