InvisibleQuestionBlock.gd 395 B

12345678910
  1. extends Block
  2. func on_area_entered(area: Area2D) -> void:
  3. if area.owner is Player:
  4. var player: Player = area.owner
  5. if player.velocity.y < 0 and player.global_position.y > $Hitbox.global_position.y and abs(player.global_position.x - global_position.x) < 8:
  6. player_block_hit.emit(area.owner)
  7. player.velocity.y = 0
  8. player.bump_ceiling()
  9. $Collision.set_deferred("disabled", false)