Adds gravitational pull to the entity.
public this .gravity([comp])
Enable gravity for this entity no matter whether comp parameter is not specified, If comp parameter is specified all entities with that component will stop this entity from falling. For a player entity in a platform game this would be a component that is added to all entities that the player should be able to walk on.
Crafty.e("2D, DOM, Color, Gravity")
.color("red")
.attr({ w: 100, h: 100 })
.gravity("platform")
public this .gravityConst(g)
Set the gravitational constant to g. The default is .2. The greater g, the faster the object falls.
Crafty.e("2D, DOM, Color, Gravity")
.color("red")
.attr({ w: 100, h: 100 })
.gravity("platform")
.gravityConst(2)
public this .antigravity()
Disable gravity for this component. It can be reenabled by calling .gravity()