mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
added the game
This commit is contained in:
22
Scripts/Classes/Blocks/TurnBlock.gd
Normal file
22
Scripts/Classes/Blocks/TurnBlock.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
extends Block
|
||||
const SPINNING_TURN_BLOCK = preload("uid://b8dalotrk2oci")
|
||||
func on_block_hit(player: Player) -> void:
|
||||
if item != null:
|
||||
if mushroom_if_small:
|
||||
item = player_mushroom_check(player)
|
||||
dispense_item()
|
||||
else:
|
||||
spin()
|
||||
|
||||
func on_shell_block_hit(_shell: Shell) -> void:
|
||||
if item != null:
|
||||
dispense_item()
|
||||
else:
|
||||
spin()
|
||||
|
||||
func spin() -> void:
|
||||
await get_tree().create_timer(0.15, false).timeout
|
||||
var spinning = SPINNING_TURN_BLOCK.instantiate()
|
||||
spinning.position = position
|
||||
add_sibling(spinning)
|
||||
queue_free()
|
Reference in New Issue
Block a user