Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # not from an actual project (I deleted it recently, oops), this is just a sample of what I did to achieve camera panning (really bad
- # code, and I don't even know if it works)
- extends Node2D
- @onready var pov = $Camera2D
- var moving_left = false
- var moving_right = false
- var pan_speed = 5
- func _process(_delta: float) -> void:
- if moving_left:
- pov.position.x -= pan_speed
- elif moving_right:
- pov.position.x += pan_speed
- func _on_left_mouse_entered():
- moving_left = true
- func _on_left_mouse_exited():
- moving_left = false
- func _on_right_mouse_entered():
- moving_right = true
- func _on_right_mouse_exited():
- moving_right = false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement