Skip to content

Instantly share code, notes, and snippets.

@brettchalupa
Created April 3, 2023 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettchalupa/b097b45fe73e71c1ca2396e066bb3bc9 to your computer and use it in GitHub Desktop.
Save brettchalupa/b097b45fe73e71c1ca2396e066bb3bc9 to your computer and use it in GitHub Desktop.
Godot Player Input Sample
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