HTML and CSS Reference
In-Depth Information
The one addition we will add to the boxes that we did not have for the walls is using the
SetUserData() method of the b2Body object. This allows us to create a dynamic object that
holds any type of data we might need and attach it to the body. For our purposes, we will
attach an object that holds the width and height of the boxes (in MTS units) so that we can
easily model them on the Canvas in our drawScreen() function.
newBox . SetUserData ({ width : boxWidth / scaleFactor , height : boxHeight / scaleFactor })
boxes . push ( newBox );
Search WWH ::

Custom Search