Attach a script to the HorizontalFan node
We need access to the GPUParticles2D
Create ready variables for these
create a variable for the horizontal force
create a variable for the player
and the body exited signal
Code the body entered function
so that if the body is in the player group
you assign the body to the player variable
you can turn the animation on or off at this point
and set the particles to emit
In our case since the on animation is set to autoplay
and the particles emitting property is on
lines 18 and 19 are not required.
Code the body exited function
so that if the player leaves the
fan area the player variable is
set to null so that no forces
Because the fan should repeatedly
if the player is not null
call the push_across function
Create a new variable to represent the external force
Create the push_across function
It receives one parameter
set the external force to match the parameter received