In the roots, the FacemaskIdle and FacemaskRun are the player sprites i made so when he comes on contact or collects the facemask it would switch to those animation instead of Idle and Run which is the Character that has no facemask on. i hope you get my idea
this is the code for my player:
func physicsprocess(delta):
var inputvector = Vector2.ZERO
inputvector.x = Input.getactionstrength("right") - Input.getactionstrength("left")
inputvector.y = Input.getactionstrength("down") - Input.getactionstrength("up")
inputvector = inputvector.normalized()
if input_vector != Vector2.ZERO:
animationTree.set("parameters/Idle/blend_position", input_vector)
animationTree.set("parameters/Run/blend_position", input_vector)
animationState.travel("Run")
velocity = velocity.move_toward(input_vector * SPEED, ACCELERATION * _delta)
else:
animationState.travel("Idle")
velocity = velocity.move_toward(Vector2.ZERO, FRICTION * _delta)
velocity = move_and_slide(velocity)
func facemask_wear():
facemask = facemask + 1
print("I have a facemask")