Advertisement
godzillavskong

Untitled

May 5th, 2021
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extends KinematicBody
  2.  
  3. const MOVE_SPEED = 4
  4. const MOUSE_SENS = 0.5
  5.  
  6. onready var anim_player = $AnimationPlayer
  7. onready var raycast = $RayCast
  8.  
  9. func _ready():
  10.     Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
  11.     yield(get_tree(), "idle_frame")
  12.     get_tree().call_group("zombies", "set player", self)
  13.  
  14. func _input(event):
  15.     if event is InputEventMouseMotion:
  16.         rotation_degrees.y -= MOUSE_SENS * event.relative.x
  17.  
  18. func _process(_d):
  19.     if Input.is_action_pressed("exit"):
  20.         get_tree().quit()
  21.     if Input.is_action_pressed("restart"):
  22.         kill()
  23.  
  24.  
  25. func _physics_process(_d):
  26.     var move_vec = Vector3()
  27.     if Input.is_action_pressed("move_forwards"):
  28.         move_vec.z -= 1
  29.     if Input.is_action_pressed("move_backwards"):
  30.         move_vec.z += 1
  31.     if Input.is_action_pressed("move_left"):
  32.         move_vec.x -= 1
  33.     if Input.is_action_pressed("move_right"):
  34.         move_vec.x += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement