线与对象的碰撞(Corona SDK) [英] Collision of a line and object ( Corona SDK )

查看:109
本文介绍了线与对象的碰撞(Corona SDK)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发具有线条和物理对象的游戏

I am developing a game when there is a line and physics object

行代码是:

有趣的是,当我编写代码(例如碰撞在这里")(例如)时,它们甚至不会碰撞!

And the interesting thing is that when i code print ("collision is here") (for ex) they some how don't even collide!

line和obj主体都是静态的

Both line and obj bodies are static

如何使此碰撞隐藏起来?预先感谢!

How can make this collision happed? thanks in advance!

推荐答案

如果两行都是静态的,则创建一个函数,在该函数中,您可以检测到两个对象的x和y并相应地建立方程式,例如:line.x + 20> obj .x然后打印(碰撞).

IF both lines are static make a function where you detect the x and y of both object and make equation accordingly, for example : line.x + 20 > obj.x then print(collide).

这篇关于线与对象的碰撞(Corona SDK)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆