Game Development Reference
In-Depth Information
The ellipse moves as you tilt the device and bounces off the sides of the screen
As discussed, we can place a display object at the coordinates of the physics object at every frame
as the positions are updated. In the preceding example, we used an ellipse. Here, we can simply
replace the line that draws the ellipse with one that draws a sprite:
sprite("Planet Cute:Character Boy", ball.x, ball.y, ball.radius*2)
Not all of the physics functions are available in Codea. The following list describes those that Codea
allows us to work with:
body.applyForce : This function applies force to the physics body as a vector.
body.applyTorque : This function applies torque to the physics body.
body.destroy : This function destroys the physics body, which is then garbage-
collected.
body.getLinearVelocityFromLocalPoint : This function gets the linear velocity of
the body at a given point in local space.
body.getLinearVelocityFromWorldPoint : This function gets the linear velocity of
the body at a given point in world space.
body.getLocalPoint : This function returns the point of the physics body in local
coordinates.
body.getWorldPoint : This function returns the point of the physics body in world
coordinates.
Search WWH ::




Custom Search