Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits)

I set up a spawn_manager script that spawns obstacles every few seconds using a formula that uses randf_range among other things to randomize the interval, then I basically do the same thing for the position.x after instantiating the cactus node in a different function that selects what to spawn and spawn it in -20 pixels off-screen on the Y axis

func spawn_node(instance):
		var spawn_position = Vector2 (clamp(((randi_range(0, 4000) + randi_range(0, 4000)) / 20), 3, 385), -20)
		instance.position = get_spawn_position()
		get_tree().root.add_child(instance)

(the formula is kinda whack but I felt the rand values were very predictable otherwise, it seemed to just go back and forth)

(+1)

Thanks bro!