can any one tell me why either the touch or tap event does not work on phone
[code]
system.activate( “multitouch” )
local physics = require(“physics”)
physics.start()
–physics.setGravity( 0, 0)
physics.setScale( 100 )
display.setStatusBar( display.HiddenStatusBar )
local atomGroup = display.newGroup()
local button2
local sky = display.newImage(‘Background6.png’)
atomGroup:insert(sky)
local atom = {}
local star = {}
atom[1] = display.newImage(‘arrow3.png’)
atom[1].xScale = 0.1
atom[1].yScale = .1
–atom[1]:setReferencePoint(display.BottomCenterReferencePoint)
atom[1].x = 50
atom[1].y = 150
atomGroup:insert(atom[1])
physics.addBody( atom[1],“kinematic”, { density=0.2, friction=0.1, bounce=0.5 } )
atom[2] = display.newImage(‘blue.png’)
–atom[1]:setReferencePoint(display.BottomCenterReferencePoint)
atom[2].x = 410
atom[2].y = 200
atom[2].xScale = 0.1
atom[2].yScale = .1
atomGroup:insert(atom[2])
atom[3] = display.newCircle( 10, 10, 30 )
–atom[1]:setReferencePoint(display.BottomCenterReferencePoint)
atom[3].x = 50
atom[3].y = 150
atomGroup:insert(atom[3])
physics.addBody( atom[2],“kinematic”, { density=0.2, friction=0.1, bounce= 0 } )
–[[
atom[2] = display.newCircle( 10, 10, 20 )
atom[2].x = 250
atom[2].y = 100
atomGroup:insert(atom[2])
–]]
star[1] = display.newImage(‘Star.png’)
star[1].x = 100
star[1].y = 150
atomGroup:insert(star[1])
local bricks = {}
local n = 0
local function throwBrick()
n = n + 1
bricks[n] = display.newImage( “small1.png”)
physics.addBody( bricks[n], { density=1.0, friction=0.5, bounce=0 } )
bricks[n].x = atom[1].x
bricks[n].y = atom[1].y
atomGroup:insert(bricks[n])
– remove the “isBullet” setting below to see the brick pass through cans without colliding!
bricks[n].isBullet = true
bricks[n].angularVelocity = 90
– bricks[n]:applyForce( 1000, 0, bricks[n].x, bricks[n].y )
bricks[n]:applyLinearImpulse( 100, 0, bricks[n].x, bricks[n].y )
end
local speed1 = 5
local radians1 = 0
local degrees1 = 0
local radius1 = 5
local radius2 = 13
local speed2 = 5
local radians2 = 0
local degrees2 = 0
– local radius2 = 4
local speed3 = 5
local radians3 = 0
local degrees3 = 0
local radius3 = 5
function firstm()
degrees1 = degrees1 + speed1
radians1 = degrees1 * math.pi/180
local positionx1 = atom[1].y + math.cos(radians1) * radius1
local positiony1 = atom[1].x + math.sin(radians1) * radius2
atom[1].y = positionx1
atom[1].x = positiony1
degrees2 = degrees2 + speed2
radians2 = degrees2* math.pi/180
local positionx2 = atom[2].y - math.cos(radians1) * radius1
local positiony2 = atom[2].x - math.sin(radians1) * radius2
atom[2].y = positionx2
atom[2].x = positiony2
–myRoundedRect1.y = positiony
end
local function start()
– throw 3 bricks
timer.performWithDelay( 100, throwBrick, 1 )
end
Runtime:addEventListener( “enterFrame”, firstm );
function control(e)
if (e.phase == “began”) then
Runtime:removeEventListener(“enterFrame”, firstm)
– degrees = degrees -1
elseif (e.phase == “ended”) then
Runtime:addEventListener( “enterFrame”, firstm );
end
return true
end
atom[1]:addEventListener( ‘tap’, throwBrick )
atom[3]:addEventListener(“touch”, control) [import]uid: 40990 topic_id: 12485 reply_id: 312485[/import]