sfx update

This commit is contained in:
ultrablob 2024-04-20 09:45:17 -04:00
parent bf16dfe508
commit cd361e3338
16 changed files with 682 additions and 105 deletions

View file

@ -1,18 +1,33 @@
extends Marker2D
@export var item: PackedScene
@export var random_on_screen = false
@export var random_off_screen = false
@export var radius = 100
func spawn():
if get_tree().paused:
return
var spawn_loc = Vector2.ZERO
if random_off_screen:
var random = randi_range(1, 4)
if random == 1:
spawn_loc = Vector2(-50, 1080 * randf())
elif random == 2:
spawn_loc = Vector2(1950, 1080 * randf())
elif random == 3:
spawn_loc = Vector2(1920 * randf(), -50)
elif random == 4:
spawn_loc = Vector2(1920 * randf(), 1080 + 50)
for i in range(10):
var test_pos = Vector2(randf(), randf()) * Vector2(1920, 1080)
if not $"../CollisionCheck".is_clear(test_pos, radius):
continue
var node = item.instantiate()
node.global_position = test_pos
print(node.global_position)
$/root/Node2D.add_child(node)
spawn_loc = test_pos
break
var node = item.instantiate()
node.global_position = spawn_loc
node.rotation_degrees = 360 * randf()
print(node.global_position)
$/root/Node2D.add_child(node)