Could someone please tell me why this does not register a collision…
local physics = require("physics")
Random = math.random
local screenW = display.contentWidth
local screenH = display.contentHeight
local screenHW = screenW \*.5
local screenHH = screenH \*.5
physics.setDrawMode("hybrid")
physics.start()
physics.setGravity(0, 0)
local function MySimulation()
local levelGroup = display.newGroup()
local player = display.newRect(levelGroup, 0, screenHH, screenW, 5)
physics.addBody(player, "dynamic", {isSensor=false, density=1.0, friction=1.0})
local function ballCollision(self, event)
print("here")
print(event.other.name)
end
local ball = display.newCircle(levelGroup, screenHW, 300, 20)
--ball.xReference = screenHW
ball.yReference = screenHH - 300
physics.addBody(ball, "dynamic", {isSensor=false, density=1.0, friction=1.0, radius=10})
ball.collision = ballCollision
ball:addEventListener("collision", ball)
ball.angularVelocity = 20
end
MySimulation()
I have tried 5 or 6 different ways to get this simple movement to register a collision with complete failure… [import]uid: 21331 topic_id: 23845 reply_id: 323845[/import]
