Thanks.
Here’s what I have so far (not much):
–
– Main.lua
–
– include Corona’s “physics” library
local physics = require “physics”
–physics.setGravity(0, 9.2);
physics.start(); --physics.pause();
– forward declarations and other locals
local screenW, screenH, halfW, halfH = display.contentWidth, display.contentHeight, display.contentWidth*0.5, display.contentHeight*0.5
– BEGINNING OF YOUR IMPLEMENTATION
–
– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
–
– Hide status bar
display.setStatusBar( display.HiddenStatusBar )
– Place the background
local background = display.newImage( “background.jpg”);
background.anchorX = 0;
background.anchorY = 0;
-----------------------------------------------------------------------------------------
– Creat “frog”
local frogBody = display.newRect ( 60, 275, 55, 35 );
frogBody:setFillColor( 0, 1, 0);
frogBody.strokeWidth = 3;
frogBody:setStrokeColor( 0, 0, 0 );
frogBody.rotation = -10;
– Creat “Lillypad”
local lillypad = display.newRect ( 60, 305, 80, 10 );
lillypad:setFillColor( 0, .6, 0);
lillypad.strokeWidth = 1;
lillypad:setStrokeColor( 0, 0, 0 );
– add physics to the frogbody, Lilypad
physics.addBody( frogBody, { density=.85, friction=.35, bounce=0 } );
physics.addBody( lillypad, “static”, { density=1.0, friction=0.3, bounce=.2 } )
local function moveFrog( event )
if ( event.phase == “began” ) then
--code executed when the frog is touched
frogBody:applyForce( 1000, 1990, frogBody.x, frogBody.y )
end
return true --prevents touch propagation to underlying objects
end
frogBody:addEventListener( “touch”, moveFrog ) --add a “touch” listener to the frog body