Index

BounceEdgeCollision

BounceEdgeCollision(<-currentPosition <-lastPosition <-reflectionScale) ->newLastPosition ->newPosition

Description

Calculates a bounce off of the edge of the map. Given two positions that represent the current and previous positions of a moving object, this call will calculate a new position and previous position for the moving object. The new positions will calculate a colllision with any mape edge and generate a reflection so that the moving object will appear to have bounced off of the edge.

Note that if there is no edge collision then the 'w' (the last) position in the resulting vectors will be 0 (false). It will be 1 if there was a collision. Also note that if there is no terrain collision then the resulting newPostion and newLastPosition will be equal to currentPosition and lastPosition.

Examples

BounceEdgeCollision(<-position, <-lastPosition, 1) ->nlp ->np
if (<-np.w)
   <-np ->position
   <-nlp ->lastPosition
endif

Index