Game Development Reference
In-Depth Information
We can also extend this by adding more physics objects that we can interact with using the mouse.
To do so, we can create multiple objects.
poly = {-32, 32, 32, 32, 32, -32, -32, -32}
mass = 1
function makeObject()
moment = MOAICpShape.momentForPolygon (mass, poly)
body = MOAICpBody.new(1, moment)
space:insertPrim(body)
shape = body:addPolygon( poly )
shape:setElasticity( 0.8 )
shape:setFriction( 0.8 )
shape:setType( 1 )
space:insertPrim( shape )
end
for i=1, 15 do
makeObject()
end
Notice how the objects interact with each other and can be manipulated with a mouse. We can also
attach an image to the physics body; this will display the image instead of the physics body.
image = MOAIProp2D.new()
image:setDeck(texture)
image:setParent(body)
layer:insertProp(image)
Moai Cloud
When you log into your Moai account, you are greeted with the Moai dashboard, where you can set
up your cloud account and select other options. The cloud service that you can create here is totally
independent of whether you use Moai or any other framework or browser to consume these services.
Creating a Web Service
Let's start with creating a web service. You can create the service from the dashboard by clicking the
Create Service button under Moai Cloud Services. Figure 10-13 shows the screen for creating a service;
you mainly need to provide an application name while accepting the remaining default settings.
 
Search WWH ::




Custom Search