The_Dark_Side_of_Earth/utils/platform.gd

16 lines
445 B
GDScript

class_name Platform extends StaticBody2D
var building
func _ready() -> void:
# Choose a platform design at random
if(randf() > 0.5):
$Sprite2D.visible = true
$Sprite2D2.visible = false
# Stretch platforms depending on their height to prevent gaps in the ceiling
func init_at_horizontal_distortion(distortion : float):
scale.x *= distortion
# When a platform is destroyed, destroy the whole building
func destroy():
building.destroy()