Game Development Reference
In-Depth Information
the matrix where we have be able to understand things by looking at numbers, so we'll create a GUI
version of the same code.
Figure 8-14. Using the enterFrame handler to make a red circle bounce around the screen
local point = {x=0,y=0}
local speed = {x=1,y=1}
local dimensions = {0,0,320,480}
local ball = display.newCircle(0,0,20)
ball:setFillColor(255,0,0)
function positionBall(thePoint)
print("ball is at" .. thePoint.x .. " , ".. thePoint.y)
ball.x = point.x
ball.y = point.y
end
Search WWH ::




Custom Search