What I have doesn't work in Fullscreen and I cant figure out how to add acceleration similarly to my movement acceleration for when joystick input is being used
extends KinematicBody2D
var playerMaxSpeed: int = 300
var playerAccel: int = 2250
var playerFriction: int = 2250
var mouseSensitivity= 500
var mouseAccel = 100
var velocity = Vector2.ZERO
func physicsprocess(delta):
var look_Vector = Vector2.ZERO
look_Vector.x = Input.get_action_strength("RS_right") - Input.get_action_strength("RS_left")
look_Vector.y = Input.get_action_strength("RS_down") - Input.get_action_strength("RS_up")
if abs(look_Vector.x) == 1 and abs(look_Vector.y) == 1:
look_Vector = look_Vector.normalized()
var aim_Vector = mouse_Sensitivity * look_Vector * delta
if (aim_Vector):
Input.warp_mouse_position(get_viewport().get_mouse_position() + aim_Vector)
var inputAxis = get_input_axis()
if inputAxis == Vector2.ZERO:
apply_friction(delta)
else:
apply_Accel(inputAxis * player_Accel * delta)
velocity = move_and_slide(velocity)
look_at(get_global_mouse_position())
func getinputaxis():
var inputAxis = Vector2.ZERO
inputAxis.x = float(Input.getactionstrength("right")) - float(Input.getactionstrength("left"))
inputAxis.y = float(Input.getactionstrength("down")) - float(Input.getactionstrength("up"))
return inputAxis.normalized()
func applyfriction(delta):
velocity= velocity.movetoward(Vector2.ZERO, playerFriction * delta)
func applyAccel(playerAccel):
velocity += playerAccel
velocity = velocity.limitlength(playerMaxSpeed)
func applyMouseAccel(Accel):
velocity += playerAccel
velocity = velocity.limitlength(playerMaxSpeed)