BulletBill.gd 724 B

1234567891011121314151617181920212223242526272829
  1. class_name BulletBill
  2. extends Enemy
  3. static var amount := 0
  4. var can_despawn := false
  5. const MOVE_SPEED := 96
  6. var cannon := false
  7. func _ready() -> void:
  8. amount += 1
  9. $Sprite.scale.x = direction
  10. if cannon:
  11. await get_tree().create_timer(0.2, false).timeout
  12. z_index = 0
  13. func _physics_process(delta: float) -> void:
  14. global_position.x += (90 * delta) * direction
  15. func _exit_tree() -> void:
  16. amount -= 1
  17. func on_screen_entered() -> void:
  18. if Global.level_editor != null:
  19. if Global.level_editor.current_state == LevelEditor.EditorState.PLAYTESTING or Global.current_game_mode == Global.GameMode.CUSTOM_LEVEL:
  20. AudioManager.play_sfx("cannon", global_position)
  21. else:
  22. AudioManager.play_sfx("cannon", global_position)