Created
August 21, 2017 11:46
-
-
Save RameshRavone/623483a2bf7eac7977098ca53a12c31a to your computer and use it in GitHub Desktop.
Simple godot input events
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 Control | |
| var pressed = false | |
| func _ready(): | |
| pass | |
| func _gui_input(event): | |
| if not pressed and event is InputEventMouseButton and event.is_pressed(): | |
| pressed = true | |
| touchStarted(event) | |
| elif pressed and event is InputEventMouseButton and not event.is_pressed(): | |
| pressed = false | |
| touchEnded(event) | |
| if event is InputEventMouseMotion and pressed: | |
| touchDraged(event) | |
| pass | |
| func touchStarted(event): | |
| print("Touch Started") | |
| pass | |
| func touchEnded(event): | |
| print("Touch Ended") | |
| pass | |
| func touchDraged(event): | |
| print("Touch Moved") | |
| pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment