I have the next scene:
There are 2 collision objects, BOX[KINEMATIC] and MAN[STATIC], which shoud colide, and print the message in console…but I don`t work…help me please to understant the error!!!
grounds = {
"ground1","ground2","ground3",
"ground6","ground5","ground4",
"ground9","ground8","ground7",
"ground12","ground11","ground10",
"ground15","ground14","ground13",
}
function init(self)
self.speed = 2
end
function update(self)
for index,element in pairs(grounds) do
local position = go.get_position(element)
local man_pos = go.get_position("man")
position.x = position.x - self.speed
man_pos.x = man_pos.x + 0.3
if position.x <= -50 then
position.x = 1400 + ( position.x + 50)
end
if man_pos.x >= 1400 then
man_pos.x = 20
go.set_position(man_pos,"man")
end
go.set_position(man_pos, "man")
end
end
--Here I try to detect the colision
function on_message(self, message_id, message, sender)
if message_id == hash("collision_response") then
print("Colision detected!")
end
end