Mechanics 3 - Fans

Game Assets:

All of the assets required can be downloaded here.

The sprites for the fans are in the Traps --> Fan Folder. For the particles see the 'Other' folder. 


Two Types of Fans:

Horizontal

Blowing along the X - Axis

Vertical

Blowing along the Y - Axis

To show the player which direction the wind is blowing, we will use particles

The fan will apply force to the Player jumping on it.

Add an instance variable called ForceToApply to the fan

For the force upwards, give it a value of -250 for the Vertical Fan

For force to the right or left, give it a value of 70 or -70  for the Horizontal Fan

When a fan spins it will create dust particles.

We need to know WHICH dust particles are active.

Add an instance variable to track the UID

UNIQUE ID of the dust particles

Do this for bothe types of fans.

What are UIDs?

In Construct 3, each object has a unique identifier, called a UID, which is always a positive number

We assign a starting value of -1 to the DustParticlesUID instance variable because it is impossible for a UID to be negative. 

This way, when we check the value of DustParticlesUID, we can easily tell whether it has been assigned a real UID yet or not. 

If the value is still -1, it means the fan hasn’t yet been associated with a dust particle, and we know we need to assign it.


Note: How the fan and dust work with UIDs
We will code each fan to have the same instance as the UID of their respective dust particle.