如何检查player.position.y是否高于图块
嘿,基本上我正在尝试在 cocos2d 中进行碰撞。我让他跌倒,当他接触平台时,平台顶部有一个看不见的瓷砖(用于检查它是否接触玩家),他停止移动。
我进行碰撞的方式是,如果他接触到可碰撞的瓷砖,他会停止所有移动,即左右移动。
我认为可行的是检查玩家碰撞的瓷砖是否“y”高于玩家的瓷砖,然后继续移动,如果不是则停止移动。
我知道这听起来很令人困惑,任何人都有想法或问题,我可以回答以澄清它。
提前致谢
Hey, basically I am trying to do collision in cocos2d. I have him falling and when he touches the platform, which has an invisible tile on top of it ( used for checking if it touches player) he stops moving.
The way I did my collision was so if he came in contact with a collidable tile he would stop all movement, ie left and right.
What i thought would work was checking if the tile the player was colliding with, 'y' is higher than that of the player then carry on moving, if not then stop moving.
Sounds confusing I know, anyone have ideas, or question i could answer to clear it up.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
?不是吗:
? isnt it: