Game Development Reference
In-Depth Information
Figure 8-17. The physics-based elevator that responds to the up and down buttons
Note The use of delta=true allows for relative movement, so the platform will move 100 pixels up
or down relative to the current position.
Zooming Out for an Overview
Many games use a camera mode to show the entire area, and then zoom in to the player to start
playing. We'll attempt to re-create that effect. The way it works is that the elements are placed on
the screen in the place that they need to be at. This world space could be larger than the screen
size, so they might reside outside of the visible screen area. We'll allow the user to zoom out for an
overview by touching the screen, and on releasing the touch, the screen will zoom back in to the
original position.
local _H = display.contentHeight
local _W = display.contentWidth
--
function position(theObject, xPos, yPos, refPoint)
local refPt = refPt or display.TopLeftReferencePoint
 
Search WWH ::




Custom Search