Created
July 20, 2024 16:29
-
-
Save kenmorechalfant/07065f2c397249f8d2a8ddda0f550a48 to your computer and use it in GitHub Desktop.
player 1.0
This file contains hidden or 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 CharacterBody2D | |
@export var SPEED: float = 50.0 | |
var _move_joy = Vector2.ZERO | |
func _ready(): | |
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN | |
pass | |
func _process(_delta): | |
_move_joy = Input.get_vector("move_left", "move_right", "move_up", "move_down") | |
_move_update() | |
func _move_update(): | |
if (_move_joy.length() > 0): | |
velocity = _move_joy * SPEED | |
else: | |
velocity = Vector2.ZERO | |
func _physics_process(_delta): | |
move_and_slide() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment