The Physics Objects
After version 2.5 Clickteam Fusion 2.5 comes with a full implementation of the well-known Box2D engine. This implementation includes movements (described in the objects common properties page), and objects. This section of the documentation describes the objects available to help you create your physics-based game. Physics Engine Object Fan Object Magnet Object Treadmill Object Particles Object Rope and Chain Object
The Physics – Rope and Chain Object
The Physics – Rope and Chain object creates a realistic rope in the physical world. The Properties Angle This property contains the initial angle of the rope. The rope will react to the gravity when the frame runs. Number of elements This property contains the number of elements that the rope is made from. This number includes the first and last elements. Attached on both sides Check this property and the end of the rope will be attached to a fixed point. Use this to create rope bridges for example. You might want to reduce the density of the rope to avoid bending. Start image Contains the image displayed at the beginning of the rope. The hot-spot of this image is where the rope will be attached to. The action point is where the next element will be attached. Images Contains the images that creates the rope. If more than one image is provided, the images are used one after the other. The hot-spot of each image is where the element will be attached to the previous element, and the action point is where the next element will be attached. End image Contains the image used to display the end of the rope. The same remark applies for the hot-spots and action points. Friction Contains the friction parameter of the rope. A friction of 0 will make all the other objects slide on the rope. A friction of 100 will make them stick to it. Elasticity Contains the elasticity factor of the rope. Use an elasticity of 0 and the other object will stop when colliding with the rope. Use and elasticity of 100 and they will bounce on the rope. Density Contains the density of the rope. Use a low density to avoid the rope expanding. Gravity scale Contains a percentage of the world’s gravity to apply to the rope. A value of 0 will make the rope float in the air. A value of -100 will make it go in the reverse direction of the world’s gravity. A value of 100 will apply the world’s graivty entierely. Engine ID This property contains the identifier of the Physics – Engine object to use, if you decide to use more than one object on the frame. The Conditions An element collides With a backdrop This condition is true when an element collides with a backdrop object of the world. With another object This condition is true when an element collides with another object of the world. An element leaves the frame On the left This condition is true when an element of the rope leaves the frame area on the left. On the right This condition is true when an element leaves the frame on the right. On the top This condition is true when an element leaves the frame on the top. On the bottom This condition is true when an element leaves the frame on the bottom. On each element This condition is called when you perform a “For each element” action. It is called for every one of the elements that make the rope. The Actions Stop Stops the movement of the rope. If it is called during a collision with another object of the world, the rope will be pushed by it. Climbing Attach to rope Attaches an object to the rope, allowing it to climb up and down. Parameters: object to attach, and horizontal distance to attach the object to. Detach from rope Detaches an object that was attached to the rope. Please note that the object will not be able to re-attach to the rope for a period of 4 seconds. Climb up one element Move the attached object up to the previous element of the rope. Climb down one element Move the attached object down to the next element of the rope. For each element Start loop Starts a loop that will explore all the elements of the rope. This action calls the “On each element” condition in sequence. Stop loop Stops the execution of the current loop. The Expressions All the following expressions awaits the number of the element as parameter. Coordinates X coordinate of element Returns the horizontal coordinate of one element. Y coordinate of element Returns the vertical coordinate of one element. X coordinate of middle of element Returns the horizontal coordinate of the center of one element. Y coordinate of middle of element Returns the vertical coordinate of the center of one element. X coordinate of endof element Returns the horizontal coordinate of the end of one element. Y coordinate of end of element Returns the vertical coordinate of the end of one element. Angle of element Returns the angle, in degrees, of the given element. Current element index Returns the index of the element involved in a collision, or that leaves the frame area. Loop index Returns the index of the loop when using a “For each element / Start loop” action.
The Physics – Particles Object
The Physics – Particles object is a particle generator. It creates myriads of particles in the physical world, with various speed and directions. It is very flexible and can be used to your heart’s desire. The Properties Emission This property allows you to define where the particles will be created. From a point The particles will be created at the exact position of the particles object, from a single point. From a zone The object can be resized : the particles will be created at random in the zone defined by the object. Create particles at start of frame The object will emit particles automatically when the frame starts if this property is checked. If not checked, you will have to use the “Create particles” action. Creation speed If the previous property is checked, this property contains the speed at which the particles are created. Number This property contains the number of particles to create at each loop. Warning, high numbers can flood the screen very rapidely (and slow down the application). Angle This property allows you to define the angles in which the particles will be created. Note that the chosen angle is modified by applying the next property. Angle interval Once the angle has been chosen using the previous property, a random number is generated, ranging from -“Angle interval” to +”Angle interval”, and this number is added to the angle. As a result, the particles will be spread in a portion of circle (depending on how big this value is). Initial speed This property contains the speed of the created particles. The speed will be modified by the next property. Speed interval As for the angle, a random number is generated ranging from -“Speed interval” to +”Speed interval”, and added to the value of the speed property. As a result, the speed of the created particles will be different depending on the value of this property. Initial torque This property contains this initial torque of the particle. If non-zero, the particles will rotate at a constant pace. Value range: from -250 (clockwise, very fast) to 250 (anti clockwise, very fast). Values like 10 are usually chosen for good effects. Applied force This property contains a force that is applied constantly to each particle, making it accelerate (for positive values), or decelerate (for negative values). Applied torque This property contains a torque to be applied to the created particles, making them accelerate their rotation as they move. Value range: from -250 (clockwise, very fast) to 250 (anti clockwise, very fast). Particle images This property contains a list of images used to display the particles. You can define up to 32 different images. The images will be played in sequence at the speed defined by the next property. Animation speed This property contains the speed of the animation of the particles. Loop animation If checked, the animation of the particle will restart at the first image when the end is reached. Scale This property allows you to increase or reduce the size of the particles. The particles will keep the same size if the property is set to 0, they will grow if the property is over 0 and shrink if it is below 0. Warning : collision detection with the particles will NOT work if the particle size changes constantly. It will only work with a value of 0 in this property. Friction This property contains the friction parameter of the created particles. A friction of 0 will make your particles slide on all the other objects, a value of 100 will make them stick to the other objects. Elasticity This property contains the elasticity parameter of the created particles. A value of 0, and the particle will not bounce at all when colliding with other objects. A value of 100 and they will bounce forever. Density This property contains the density of the object. A higher value will make your particles heavier (they will have more effect on the other objects). A value of 30 is usually used. Gravity factor This property contains the percentage of the world’s gravity to apply to the created particles. A value of 0 will make your particles float in the air. A negative value will make them go in the reverse direction of the world’s gravity. Engine ID This property contains the identifier of the Physics – Engine object to use, if you decide to use more than one object on the frame. The Conditions A particle collides With a backdrop This condition is true when a particle collides with a backdrop from the world. You can choose to destroy the particle or stop it for example. With another particle This condition is true when two particles collide. With another object This condition is true when a particle collides with another object of the world. A particle leaves the frame On the left This condition is true when a particle leaves the frame area on the left. You can choose to stop the particle, or destroy it. On the right This condition is true when the particle leaves the frame on the right. On the top This condition is true when the particle leaves the frame on the top. On the bottom This condition is true when the particle leaves the frame on the bottom. On each particle This condition is called when you perform a “For each particle” action. It is called for every one of the particles on the screen. The Actions Stop particle Stops the movement of the current particle. Use this action in a collision detection event. Create / Destroy Create particles This action creates a given number of particles, all at once, using the current parameters as defined in the properties of the object, or modified with actions. Destroy particle Destroys the current particle. Destroy both particles Use this action in an event beginning by a “A particle is colliding with another particle” condition. It will destroy both particles. Particles Set animation speed Changes the speed
The Physics – Treadmill Object
The Physics – Treadmill object moves the objects that enter its area of influence, at a steady and constant pace in the chosen direction. This object is perfect to create treadmill or elevators in a platform game. The Properties Angle This property contains the direction of the treadmill. If you choose more than one direction in the selector, one direction between the selected ones will be chosen at start of frame. Speed This property changes the speed of the treadmill. The higher the value, the faster the objects will move when they enter its area of influence. Active at start Check this property, and the treadmill will be active when the frame starts. If it is un-checked, you can start the treadmill from within the event editor with the “Start treadmill” action. Advanced Engine ID This property is designed to be used if you drop more than one Physics – Engine object in your frame. Enter the Engine ID value of the engine you want to use for this object. The Conditions Is treadmill active This condition is true when the treadmill is currently active. The Actions Set treadmill ON/OFF Starts or shuts down the treadmill. A parameter different from zero will turn the treadmill on, 0 will turn it off. Set speed This action allows you to change the speed of the treadmill. It expects a value between 0 and 100. Set angle This action enables you to set the angle of the treadmill. The parameter is expressed in degrees (0-360). Set width This action changes the width of the area affected by the treadmill. Set height This action changes the height of the area affected by the treadmill. The Expressions Treadmill speed Returns the current speed of the treadmill. Treadmill angle Returns the current angle of the treadmill, in degrees (0-360) Action zone width Returns the current width of the action zone of the object. Action zone height Returns the current height of the action zone of the object.
The Physics – Magnet Object
The Physics – Magnet object works like a magnet in your physical world : it attracts the objects that enter its influence area. The attraction grows as the objects get closer to the magnet. The Properties Angle This property contains the directions where the magnet will have an effect on the objects around it. You can choose for example to have a magnet that only attracts objects above it : just choose the directions between 0 and 16 in the direction selector. Strength This property contains the strength of the magnet. The higher this value, the stronger the effect of the magnet on the other objects of the physical world. Note that the effect only applies when the other objects enter the perimeter of the magnet, as defined in the frame editor. Active at start Check this property, and the magnet will be active when the frame starts. If it is un-checked, you can start the magnet from within the event editor with the “Start magnet” action. Advanced Engine ID This property is designed to be used if you drop more than one Physics – Engine object in your frame. Enter the Engine ID value of the engine you want to use for this object. The Conditions Is magnet active This condition is true when the magnet is currently active. The Actions Set Magnet ON/OFF Starts or stops the magnet. Parameter: 1 to start, 0 to stop. Set strength Changes the strength of the magnet. Parameter: value between 0 and 100. Set angle Changes the directions affected by the effect. Set width / height Changes the size of the zone affected by the magnet. The Expressions Magnet strength Returns the current strength of the magnet. Action zone width Returns the current width of the action zone of the object. Action zone height Returns the current height of the action zone of the object.
The Physics – Fan Object
The Physics – Fan object works like a fan in your physical world : it creates a stream of air. Any object that penetrates this stream will support a force in the direction of the stream. The result is that the object will slowly accelerate in the direction of the air. The direction and strength of the air can be set in the properties or with actions. The Properties Angle This property contains the direction of the air generated by the fan. If you select more than one direction in the direction selector, one direction between the selected ones will be chosen at start of frame. Strength This property contains the strength of the air generated by the fan. A value of 0 will not affect any object. A value of 100 will have a very strong effect on the objects and will make them accelerate quickly. Active at start Check this property, and the fan will be active when the frame starts. If it is un-checked, you can start the fan from within the event-editor with the “Start fan” action. Advanced Engine ID This property is designed to be used if you drop more than one Physics – Engine object in your frame. Enter the Engine ID value of the engine you want to use for this object. The Conditions Is fan active This condition is true when the fan is currently active. The Actions Set fan ON/OFF Starts of shuts down the fan. A parameter different from zero will turn on the fan, a parameter of 0 will turn it off. Set strength This action enables you to change the strength of the stream of air generated by the fan. It expects a value between 0 and 100. Set angle This action enables you to set the angle of the stream of air. The parameter expected by this action is an angle expressed in degrees, between 0 and 360. Set width This action changes the width of the area affected by the stream of air. Set height This action changes the height of the area affected by the stream of air. The Expressions Fan strength Returns the current strength of the fan. Fan angle Returns the current angle of the fan, in degrees (0-360). Action zone width Returns the current width of the action zone of the object. Action zone height Returns the current height of the action zone of the object.
The Physics – Physics Engine Object
The Physics – Engine object is the driving force behind your physics-based applications. It contains the code necessary to make the objects to move in a physical-oriented way. This object must be present in the frame if you use one of the physics-driven movements. This object also contains a number of actions to control and affect the objects of your physical world. The Properties Gravity Gravity strength This property contains the strength of the gravity of the physical world. The earth gravity value is around 10 (exactly 9.81), therefore the default value of this property is set to the earth gravity. You can change this value within the application with an action. Gravity angle This property contains the angle of the gravity. The earth gravity is directed to the bottom, but you can define a gravity directed to the top or in a custom angle. The direction of the gravity can also be changed within the application with an action. Backdrops Add backdrop objects to the world If this property is checked, any Backdrop or Quick-Backdrop object of the frame will be added to the world as obstacle or platform (depending on the obstacle property of these objects). The result is that your physical game objects (any object with a physical movement) can collide with them. Please note that these background objects cannot move within the physical world. Their position is set at start of frame. Friction This property contains the friction parameter of the created backdrop objects. A friction of zero will make all the other objects slide when they collide with them, like an Ice skate. A friction of 100 on the contrary will stop the other objects. Elasticity This property is used to set the elasticity of the created backdrop objects. An elasticity of 100 will make all the other objects that collide with them bounce, transfering the speed to the bouncing direction. An elasticity of 0 will stop the colliding objects. Any value in-between will define the strength of the bounce. Bullets Create bullets in the physical world This property defines the behavior of the “Launch an object” action. If it is checked, all objects created with this action will be physical objects moving in the world, and will interact with the other physical objects. Clickteam Fusion 2.5 only creates a physical object from this action IF this property is checked, AND if the parent object (the object from which the bullet is launched) has one of the physical movements. If one of these conditions is false, then the bullet will be created using the normal, non-physical procedure. Density This property contains the density of the bullets created by a “Launch object” action. A dense object (density=100) will be heavier, and therefore more difficult to move when colliding with other objects. On the other hand, it will have more force and will have more effect on static objects. The mass of the object is calculated by the engine from the surface of the object and from the density. Friction This property defines how the created bullets behave when they are colliding with another object. A friction of 0 will make the object slide on the other object (like ice-skating). A friction of 100 will make it stop when it collides with another object (and influence the other object). Elasticity This property contains the elasticity factor of the created bullets. Use a value of 0, and the bullets will stop as soon as they collides with another object. Use a value of 100, and the bullets will bounce, keeping the momentum of their movements. Intermediate values change the bouncing factor, and how the momentum is transfered while bouncing. Gravity scale This property contains a percentage indicating how much of the physical world gravity must be applied to the bullets. A value 100 will apply the gravity as defined in the Physic Engine object. A value of 0 makes the bullet keep a straight line. A value of 200 will put a gravity twice as strong on the bullet, and thus make it fall faster. Non-physical objects Insert non physical objects in the world If checked, all the objects created with the classic, non-physical movements will also be added to the physical world. They will have an influence on the objects of the world, (they will be able to stop them for example). But this influence is limited, as they are not true physical objects. Their position and angle in the world are forced at every loop, something that Box2D does not like very much. Do not expect these objects to behave exactly like physical objects. This option can be very handy if you have objects with a path movement, they will be able to follow their path in the physical world. Warning, if this option is checked ALL the non-physical objects will be added, like scores, lives, buttons, strings of text etc. which might slow down the engine. You may want to use the “Add object to world” action instead. Density non-physical This property contains the density of the non-physical objects added to the world. Friction non-physical This property contains the friction of the non-physical objects added to the world. Advanced Engine ID This property should only be changed if you decide to use more than one Physics Engine object in your frame. You might want to do that if you want different objects to respond to different gravities. This property contains a number (that should be unique within the various Physics Engine objects in the frame), that will be used as a reference by the physics movements and objects. For example, if you set this ID to 2, only the movements with an Engine ID of 2 will be created in this very physical world. Display factor The Box2D engine works with meters and kilograms. Clickteam Fusion 2.5 frames work with pixels. This property contains the multiplication factor to apply to Clickteam Fusion 2.5 coordinates when transfering them into the physical world. A value of