mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 23:48:11 +00:00
added the game
This commit is contained in:
22
Scripts/Classes/Blocks/SpinningTurnBlock.gd
Normal file
22
Scripts/Classes/Blocks/SpinningTurnBlock.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
extends Node2D
|
||||
const TURN_BLOCK = ("uid://bn651dli8j2rj")
|
||||
|
||||
var can_turn_back := false
|
||||
|
||||
func _ready() -> void:
|
||||
$Sprite.frame = 1
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if can_turn_back:
|
||||
if $PlayerDetectionArea.get_overlapping_areas().any(func(area: Area2D) -> bool: return area.owner is Player) == false:
|
||||
spawn_block()
|
||||
can_turn_back = false
|
||||
|
||||
func on_timeout() -> void:
|
||||
can_turn_back = true
|
||||
|
||||
func spawn_block() -> void:
|
||||
var block = load(TURN_BLOCK).instantiate()
|
||||
block.position = position
|
||||
add_sibling(block)
|
||||
queue_free()
|
Reference in New Issue
Block a user