So i wrote this bit of code with some help from a video but i want to expand on it.
local physics = require("physics")
physics.start()
physics.setGravity( 0, 10 )
--system.actvate( "multitouch" )
--physics.setDrawMode("debug")
--media.playSound( "13 300 Violin Orchestra.m4a" )
--local stopAfter200Seconds = function()
--media.stopSound()
--end
timer.performWithDelay( 10000, stopAfter200Seconds )
display.setStatusBar( display.HiddenStatusBar )
local background = display.newImage("nuclear\_iphone\_wallpapers.png")
local can = display.newImage("can.png")
can.x = display.contentWidth/2
physics.addBody(can, { bounce = 0.3, friction = 1.0 })
local can2 = display.newImage("can.png")
can2.x = can.x - 105
physics.addBody(can2, { bounce = 0.3, friction = 1.0 })
local can3 = display.newImage("can.png")
can3.x = can.x +105
physics.addBody(can3, { bounce = 0.3, friction = 1.0 })
local leftWall = display.newRect(0, 0, 1, display.contentHeight )
local rightWall = display.newRect(display.contentWidth, 0, 1, display.contentHeight )
local ceiling = display.newRect(0, 0, display.contentWidth, 1 )
physics.addBody(leftWall, "static", { bounce = 0.1} )
physics.addBody(rightWall, "static", { bounce = 0.1} )
physics.addBody(ceiling, "static", { bounce = 0.1} )
local floor = display.newImage("floor.png")
floor.y = display.contentHeight - floor.stageHeight/2
physics.addBody(floor, "static", { bounce = 0.2, friction = 1.0})
function moveCan(event)
local can = event.target
can:applyLinearImpulse( 0, -0.1, event.x, event.y )
end
local resutButton = display.newImage("Black\_Button1.png", 4, 10)
can:addEventListener("touch" , moveCan)
can2:addEventListener("touch" , moveCan)
can3:addEventListener("touch" , moveCan)
resetButton:addEventListener("touch", setup)
i would like to know how to add a timer that stops when a can hits the ground and
i would like to keep score of how many times you touch each can
also i would like to know how to add a splash screen that opens with a play button on it that starts the game
i cant seem to find anywhere that tells you how to do this if you know how please help me
thank you [import]uid: 17040 topic_id: 5521 reply_id: 305521[/import]