BrickBlock.gd 838 B

12345678910111213141516171819202122232425262728293031
  1. class_name BrickBlock
  2. extends Block
  3. var ticking_down := false
  4. func _ready() -> void:
  5. $PSwitcher.enabled = item == null
  6. if item_amount == 10 and item.resource_path == "res://Scenes/Prefabs/Entities/Items/SpinningCoin.tscn" and is_instance_valid(Global.level_editor) == false:
  7. Global.log_warning("Coin Brick Block is wrong! please report!: " + name)
  8. func on_block_hit(player: Player) -> void:
  9. if player.power_state.hitbox_size == "Big":
  10. if item == null:
  11. await get_tree().physics_frame
  12. destroy()
  13. Global.score += 50
  14. if item != null:
  15. if mushroom_if_small:
  16. item = player_mushroom_check(player)
  17. dispense_item()
  18. func on_shell_block_hit(_shell: Shell) -> void:
  19. if item == null:
  20. await get_tree().physics_frame
  21. destroy()
  22. Global.score += 50
  23. else:
  24. dispense_item()
  25. func set_coin_count() -> void:
  26. item_amount = 2