Game Development Reference
In-Depth Information
You will use magnitude to calculate the distance from the origin point of the
block to the current position of the block while pulling back.
vectorToAngle Function
vectorToAngle is a function that calculates the angle to the horizontal and the
line formed between two actors, as shown in Figure 6-8. The syntax of the
function is:
vectorToAngle(Actor1X-Actor2X, Actor1Y-Actor2Y)
Figure 6-8. vectorToAngle function
Using magnitude and vectorToAngle with the Slingshot
Figure 6-9 shows how to use the magnitude and vectorToAngle functions with
the slingshot.
 
Search WWH ::




Custom Search