UIImage碰撞效果...??? IPhone
我需要一种方法来创建碰撞效果,而不需要两个图像之间发生实际碰撞。让我更详细地解释一下...如果我有一张固定图像和一张移动图像,则两张图像在不同位置的相同 x 坐标上。基本上我希望图像看起来是碰撞的。我想像这样对移动图像进行检查...
如果(移动图像的前面是清晰的)
{[向前移动];}
其他 {[stop];}
我如何在代码中实现这个???因此,在移动图像与固定图像碰撞之前它会停止,因此它们看起来已经发生碰撞。此检查也将在 1/60 NSTimer 上运行。
欢迎任何建议。谢谢。
I need a way to create a collide effect, without the actual collision between the two images. Let me explain in more detail... If I have one fixed image and one image that is moving both images are on the same x coordinate at different positions. Basically I want the images appear to be colliding.I would want to run a check on the moving image like this...
If (front of moving image is clear)
{[move forward];}
else
{[stop];}
How would I implement this in code??? So that right before the moving image collides into the fixed image it stops, so that they appear to have collided.This check would also be running on a 1/60 NSTimer.
Any advice is welcome. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设对象从左侧移动
但说实话,在这种情况下,使用动画可能会更好
Assuming the object is moving from the left
But truth be told in this situation you would probably just be better off using an animation