Mechanics 3 - Fans
Two Types of Fans:
Two Types of Fans:
Horizontal
Horizontal
Blowing along the X - Axis
Blowing along the X - Axis
Vertical
Vertical
Blowing along the Y - Axis
Blowing along the Y - Axis
To show the player which direction the wind is blowing, we will use particles
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.
The fan will apply force to the Player jumping on it.
Add an instance variable called ForceToApply to the fan
Add an instance variable called ForceToApply to the fan
For the force upwards, give it a value of -250 for the Vertical 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
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.
When a fan spins it will create dust particles.
We need to know WHICH dust particles are active.
We need to know WHICH dust particles are active.
Add an instance variable to track the UID
Add an instance variable to track the UID
UNIQUE ID of the dust particles
UNIQUE ID of the dust particles
Do this for bothe types of fans.
Do this for bothe types of fans.
What are UIDs?
What are UIDs?
In Construct 3, each object has a unique identifier, called a UID, which is always a positive number.
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.
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.
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.
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.
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.