-
-
Save blurymind/18c08bd2a617eeb102ed237c0d62ae85 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 Camera2D | |
var dragging = false | |
func _ready(): | |
set_process_input(true) | |
func _input(event): | |
if event.type == InputEvent.MOUSE_BUTTON and event.button_index == BUTTON_MIDDLE: | |
dragging = event.is_pressed() | |
elif event.type == InputEvent.MOUSE_MOTION and dragging: | |
set_offset( get_offset() - event.relative_pos ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment