26 lines
685 B
GDScript
26 lines
685 B
GDScript
class_name Block_Spike
|
|
|
|
extends Block_Simple
|
|
|
|
# This runs BEFORE the instance is loaded.
|
|
# There's a lot you can't do here, as it doesn't exist yet.
|
|
func _init():
|
|
is_vertical = false
|
|
tags = ["Spike","Hazard"]
|
|
|
|
# This runs AFTER the instance is loaded.
|
|
# This runs BEFORE the instance is added to the scene tree.
|
|
func _ready() -> void:
|
|
if is_vertical:
|
|
rotate_block(90)
|
|
|
|
# This runs every frame. Expensive.
|
|
func _process(delta: float) -> void:
|
|
var _last_known_delta = delta
|
|
|
|
func on_player_near(body: Node2D) -> void:
|
|
print("Player is touching block with tags: " + str(tags))
|
|
|
|
func on_player_leave(body: Node2D) -> void:
|
|
print("Player is leaving block with tags: " + str(tags))
|