SuperMushroom.gd 720 B

123456789101112131415161718192021222324252627
  1. extends PowerUpItem
  2. const MOVE_SPEED := 65
  3. func _physics_process(delta: float) -> void:
  4. $BasicEnemyMovement.handle_movement(delta)
  5. func on_area_entered(area: Area2D) -> void:
  6. if area.owner is Player:
  7. if has_meta("is_poison"):
  8. area.owner.damage()
  9. queue_free()
  10. elif has_meta("is_oneup"):
  11. give_life(area.owner)
  12. else:
  13. collect_item(area.owner)
  14. func give_life(_player: Player) -> void:
  15. DiscoLevel.combo_amount += 1
  16. AudioManager.play_sfx("1_up", global_position)
  17. if Global.current_game_mode == Global.GameMode.CHALLENGE or Settings.file.difficulty.inf_lives:
  18. Global.score += 2000
  19. $ScoreNoteSpawner.spawn_note(2000)
  20. else:
  21. $ScoreNoteSpawner.spawn_one_up_note()
  22. Global.lives += 1
  23. queue_free()