Skip to content

Instantly share code, notes, and snippets.

@blurymind
Forked from neikeq/pan.gd
Last active July 29, 2016 18:58
Show Gist options
  • Save blurymind/18c08bd2a617eeb102ed237c0d62ae85 to your computer and use it in GitHub Desktop.
Save blurymind/18c08bd2a617eeb102ed237c0d62ae85 to your computer and use it in GitHub Desktop.
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