Skip to content

Instantly share code, notes, and snippets.

@vctr-uniq
vctr-uniq / shake_camera.gd
Last active May 8, 2024 09:57
Godot Engine - Shake 3D camera script
# usage example:
# curr_camera.shake(0.25, 40, 0.2)
extends Camera
var duration = 0.0
var period_in_ms = 0.0
var amplitude = 0.0
var timer = 0.0
var last_shook_timer = 0
@vctr-uniq
vctr-uniq / gist:0f3c5587e48ae57d7053f005eb157cc0
Last active September 19, 2017 11:51
Bubble sort in GDScript (Godot Engine 2.1)
var notes = [7,2,5,1]
print("notes:", notes)
for i in range(notes.size()-1, -1, -1):
#print("i:", i)
for j in range(1,i+1,1):
#print("J:", j)
if notes[j-1] > notes[j]:
var temp = notes[j-1]
notes[j-1] = notes[j]
notes[j] = temp