I suppose you could set up some detection if player hits a certain X and Y coordinate utilizing math.
For what it’s worth you CAN do it with invisible objects. I have the alpha on the invisibleBox set to .10, but you can set to 0 and see the same results.
Now I am sure you could do some welding to get the invisibleBox to tie to the “player” then make the player is sensor or something…
--Here we go for some fun
display.setStatusBar( display.HiddenStatusBar )
local physics = require("physics")
physics.start()
physics.setGravity(0, 10)
physics.setPositionIterations(32)
local game = display.newGroup()
game.x = 0
game.y = 0
local \_W = display.contentWidth
local \_H = display.contentHeight
local ball = display.newCircle (\_W/2 -10, \_H/2 - 200, 20)
physics.addBody(ball)
ball:setFillColor(255,0,0)
game:insert(ball)
local invisibleBox = display.newRect (\_W/2 -25, \_H/2,50,50)
invisibleBox.alpha = 1
invisibleBox:setFillColor(0,255,0)
game:insert(invisibleBox)
physics.addBody(invisibleBox ,"static")
local Player = display.newRect (\_W/2 -23, 483, 46,46)
Player:setFillColor(0,0,255)
local function invisibleBoxCollision(event)
if event.phase == "began" then
print("collided: InvisibleBox Hit!!")
ball:removeSelf( )
print("collided: Ball Removed!!")
end
end
--event listnener on chasebox, so if ball touches it - game over
invisibleBox:addEventListener("collision",invisibleBoxCollision)
[import]uid: 61600 topic_id: 15971 reply_id: 59157[/import]