CreatePhysicsForce
Description
Creates a global force that affects all physics sprites. Can be set to either attract to or repel sprites from a specific location. It returns a force ID that can be used to modify or delete the force later. Forces continue to act until they are deleted.
Definition
integer CreatePhysicsForce( x, y, power, limit, range, fade )
uint32_t agk::CreatePhysicsForce( float x, float y, float power, float limit, float range, int fade )
Parameters
- x - The x position of the force location in world coordinates.
- y - The y position of the force location in world coordinates.
- power - The strength of the force at 1 unit from the force point for fading forces, or the strength at all times for non fading.
- limit - Applies to fading forces only, the maximum force that will be applied to a sprite, used when the sprite is closer than 1 unit.
- range - The range that this force can act, sprites greater than this distance from the force point feel no effects. less than 0 means infinite range.
- fade - Set to 1 if the force should be weaker when sprites are further from the force point, 0 if the force is equal at all distances.