I am having trouble adding a point to the score after the player has passed a certain Y-coordinate. Here is my code:
player = display.newImageRect(“player23.png”,110,126)
player.anchorX = 0.5
player.anchorY = 0.5
player.x = display.contentCenterX
player.y = display.stageHeight / 2.1
player.scoreAdded = false
physics.addBody(player, “static”, {density = 2, friction = 0, bounce = 0,filter = { categoryBits = 1, maskBits = 65535, groupIndex = 0 },shape = { 1, -63 , 55, -31 , 54, 32 , -1, 63 , -55, 31 , -55, -32 }})
sceneGroup:insert(player)
function addscoreforplayer()
if(player.y <= display.contentCenterY + 10) then
if player.scoreAdded == false then
mydata.score = mydata.score + 1
tb.text = mydata.score
player.scoreAdded = true
end
end
end