Created
March 8, 2021 17:35
-
-
Save geekrelief/f0b4ff02d15445252eb6f63c196e64ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node | |
export var move_speed := 3.0 | |
var db | |
func _ready(): | |
db = get_node("/root/DataBind") | |
func _physics_process(delta): | |
var movement:Vector3 | |
if Input.is_action_pressed("move_forward"): | |
movement -= db.val("camera_forward") | |
if Input.is_action_pressed("move_backward"): | |
movement += db.val("camera_forward") | |
if Input.is_action_pressed("move_left"): | |
movement -= db.val("camera_right") | |
if Input.is_action_pressed("move_right"): | |
movement += db.val("camera_right") | |
db.put("movement", movement.normalized() * move_speed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends KinematicBody | |
var db | |
export var movement:Vector3 | |
func _enter_tree() -> void: | |
db = get_node("/root/DataBind") | |
db.src("movement", get_path(), "movement") | |
func _physics_process(delta): | |
move_and_slide(movement) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment