godot-steering-ai-framework/project/demos/Face/Player.gd
Nathan Lovato 7eb91a6165 Use GSAI as a class prefix instead of GST
GSAI for Godot Steering AI
2020-02-11 11:33:25 -06:00

19 lines
482 B
GDScript

extends KinematicBody2D
var speed: float
onready var agent := GSAIAgentLocation.new()
func _physics_process(delta: float) -> void:
var movement := _get_movement()
move_and_slide(movement * speed)
agent.position = Vector3(global_position.x, global_position.y, 0)
func _get_movement() -> Vector2:
return Vector2(
Input.get_action_strength("sf_right") - Input.get_action_strength("sf_left"),
Input.get_action_strength("sf_down") - Input.get_action_strength("sf_up"))