Game Development Reference
In-Depth Information
All these variables were defined as instance variables, as part of the class definition, and they're avail-
able throughout the entire class. The reason why is that in the next bit of code, you'll temporarily
recalculate these boundaries under certain conditions. If you had defined these variables directly in
the kjAjpanBn]ia method as local variables, they would have been reset to their initial values 30 times
per second, which would have immediately overwritten their recalculated values.
Inner Boundary
Inner Boundary
Figure 6-16. The player object is free to move within the inner boundary. When
it reaches one of the edges, the player object stops moving and the background
scrolls.
 
Search Nedrilad ::




Custom Search