mirror of
https://github.com/Relintai/pandemonium_demo_projects.git
synced 2024-12-21 13:56:50 +01:00
17 lines
542 B
GDScript3
17 lines
542 B
GDScript3
|
extends KinematicBody
|
||
|
|
||
|
# Moves the player
|
||
|
|
||
|
export(int, 1, 2) var player_id = 1
|
||
|
export(float) var walk_speed = 20.0
|
||
|
|
||
|
|
||
|
func _physics_process(_delta):
|
||
|
var velocity = Vector3.ZERO
|
||
|
velocity.z = -Input.get_action_strength("move_up_player" + str(player_id))
|
||
|
velocity.z += Input.get_action_strength("move_down_player" + str(player_id))
|
||
|
velocity.x = -Input.get_action_strength("move_left_player" + str(player_id))
|
||
|
velocity.x += Input.get_action_strength("move_right_player" + str(player_id))
|
||
|
|
||
|
move_and_slide(velocity.normalized() * walk_speed)
|