Sorry translate wasn’t the correct word, more like update. I setup my character to listen for collision events instead of setting up individual events for each platform. Here was my attempt…
[lua]function martian:collision(event)
local phase = event.phase
local other = event.other
if(phase == “began” and other.type == “lift”) then
martian.y = other.y
elseif(phase == “ended” or phase == “cancelled”) then
end
return true
end
martian:addEventListener(“collision”, martian)[/lua]
I removed all my other logic so we can focus on what I’m trying to do. I receive an error message: cannot translate an object before collision is resolved. As I’m looking at this right now I see my problem. “martian.y = other.y” needs to be in a runtime so it is updated as the platform moves. So I guess my question is how can I pass “other or event.other” from this collision to my main runtime function? Like…
[lua]function martian:collision(event)
local phase = event.phase
local other = event.other
if(phase == “began” and other.type == “lift”) then
liftContact = true
elseif(phase == “ended” or phase == “cancelled”) then
end
return true
end
function main()
if(liftContact == true) then
martian.y = other.y – Need to pass this other because I have multiple lifts and platforms I need to use this on.
end
end
Runtime:addEventListener(“enterFrame”, main)
martian:addEventListener(“collision”, martian)[/lua]
Hope I’ve explained it well enough, I would greatly appreciate your feedback on this.
Thanks, Chris [import]uid: 53766 topic_id: 35575 reply_id: 141434[/import]