set_physics_process(true) not working

Godot Version

Godot 4.7

Question

i’m a beginner and i tried to use set_physics_process inside another function but i don’t really understand how to do it, my goal is to raise “fill” variable by one ,15 times per second

extends Area2D

var sweet: Array = ["Bottle1", "Bottle2"]
var sour: Array = ["Bottle3"]
var fill = 0
var sourness = 0
var sweetness = 0

func _physics_process(delta: float) -> void:
	pass

func _on_area_entered(area: Area2D) -> void:
	set_physics_process(true)
	Engine.physics_ticks_per_second = 15
	$"..".texture = preload("res://Sans titre2.png")
	var objet = area.get_name()
	if objet in sweet:
		sweetness += 1
		fill += 1
		$"../../Label".text = "Fill :" + str(fill) + "%"
	elif objet in sour:
		$"../../Label".text = "sour"



func _on_area_exited(area: Area2D) -> void:
	$"..".texture = preload("res://Sans titre.png")
	

You don’t need to mess with physics ticks or toggling processing to achieve that.

var fill := 0
var fill_real := 0.0
var increments_per_second := 15

func _process(delta):
	fill_real += delta * increments_per_second
	fill = int(fill_real)
	print(fill)