40 lines
950 B
GDScript
40 lines
950 B
GDScript
extends Node2D
|
|
|
|
@export var wall_count : float = 17
|
|
@export var max_vert_diff : float = 300
|
|
@export var wall_dist : float = 800
|
|
|
|
var vert_total : float = 300
|
|
var vert_max : float = 710
|
|
var rng = RandomNumberGenerator.new()
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
if wall_count > 0:
|
|
var copy = self.duplicate()
|
|
copy.position.x = wall_dist
|
|
|
|
var dist = rng.randf_range(-max_vert_diff, max_vert_diff)
|
|
|
|
if vert_total <= 40: dist += 50
|
|
if vert_total >= 670: dist -= 50
|
|
|
|
if dist + vert_total < 0:
|
|
dist = -vert_total
|
|
elif dist + vert_total > vert_max:
|
|
dist = vert_max - vert_total
|
|
|
|
|
|
copy.position.y = dist
|
|
copy.wall_count = wall_count - 1
|
|
copy.vert_total = dist + vert_total
|
|
#print("Vtot: " + str(vert_total) + " Dist: " + str(dist))
|
|
|
|
self.add_child(copy)
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(_delta):
|
|
#Bee bad
|
|
pass
|