Last active
February 2, 2024 14:43
-
-
Save WolfgangSenff/46e5bcc2818e59c203bc51df2186aa66 to your computer and use it in GitHub Desktop.
For White...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node2D | |
const BLOCKS... # Copy/paste all blocks here | |
var blocks_array = [BLOCKS_TYPE_I, ...] # Add them all into this array | |
@onready var block_spawner = $BlockSpawner | |
@onready var safe_zone = $SafeZone | |
var spawn_countdown := 0.0 | |
const SPAWN_COUNTDOWN = 0.1 | |
func _ready() -> void: | |
spawn_block() | |
func _process(delta) -> void: | |
if Things.has_fallen: | |
spawn_countdown += delta | |
if spawn_countdown > SPAWN_COUNTDOWN: | |
spawn_block() | |
spawn_countdown = 0.0 | |
else: | |
spawn_countdown = 0.0 | |
func spawn_block() -> void: | |
var random_block = blocks_array.pick_random().instantiate() | |
get_tree().current_scene.add_child(random_block) | |
random_block.global_position = block_spawner.global_position |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment