Created
April 3, 2023 13:00
-
-
Save brettchalupa/b097b45fe73e71c1ca2396e066bb3bc9 to your computer and use it in GitHub Desktop.
Godot Player Input Sample
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 Node2D | |
var rotate_icon = true | |
var speed = 10 | |
func _process(delta: float) -> void: | |
if rotate_icon: | |
$Icon.rotate(delta) | |
if Input.is_action_pressed("move_down"): | |
$Icon.position.y += speed | |
if Input.is_action_pressed("move_up"): | |
$Icon.position.y -= speed | |
func _input(event: InputEvent) -> void: | |
if event.is_action_pressed("toggle_rotation"): | |
rotate_icon = !rotate_icon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment