碰撞时跳出物体 [英] jump object on collision
问题描述
我正在尝试实现一个使落在其上的物体反弹的杆.但是我只希望物体从顶部边缘上方落下时反弹.如果物体从波纹管传来,则该物体应通过,好像条不存在一样.这类似于小鸟在tweetjump或doodle中所做的动作(在Doodle Jump中).关于如何在电晕中实现此功能的任何提示吗?
I am trying to implement a bar that rebounds the object falling on it. however I just want the object to rebound when it falls on it from above the top edge. if the object is comming from bellow the object should pass as if the bar doesnot exsits. This is similar to what the bird does in tweetjump or doodle does in doodle jump. Any hints on how I can do this in corona ?
推荐答案
当对象与下面的条碰撞时,尝试给出
When the object collides with the bar from below, Try giving
bar.isSensor = true
在这里阅读: http://developer.anscamobile.com/reference/index/bodyissensor
设置此属性的一个用例是覆盖冲突 即将发生,例如单面平台"案, 角色只能在一个方向通过平台.
One use case for setting this property is overriding a collision that is about to happen, such as the "one-sided platform" case, where a character should pass through a platform only in one direction.
这篇关于碰撞时跳出物体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!