OK, try putting this script on your world and then press spacebar for the shake.
extends Node2D
var time = 0
var can_shake = false
var counter = 2
func _process(delta):
if can_shake:
if time < counter:
time += delta
global_position.x += lerp(rand_range(-5,5),rand_range(-5,5),time/counter)
global_position.y += lerp(rand_range(-5,5),rand_range(-5,5),time/counter)
else: can_shake = false
func _input(event):
if event is InputEventKey and event.pressed:
if event.scancode == KEY_SPACE:
can_shake = true
time = 0
You'll have to fix line 10 and 11 because they got broken apart.