cocos2d中没有正确检测到CGPath
问题描述
通过帮助和建议,我为我的精灵创建了一条路径,以便只能触摸不透明的部分.这是我想出的路径:
Through help and suggestions, I created a path for my sprite so that only the non-transparent parts can be touched. This is the path I came up with:
这适用于我的所有其他课程,除了一个.无论我在哪里点击,xcode 都会使用此代码在外部"打印:
This works for all my other classes except for one. No matter where I tap, xcode keeps printing "outside" using this code:
如果我进入 if 条件,我只能移动我的精灵,否则,即使我点击实际的彩色精灵,它也不会得到我设置的路径.我的测量值有误吗?如果没有,我做错了什么?这与我尝试使用的图像相似...
I can only move my sprites if I get inside the if-condition, not else but even if I tap on the actual, colored sprite, it doesn't get the path I set. Are my measurements wrong? If not, what am I doing wrong? This is similar to the image I'm trying to use...
推荐答案
这仅适用于图像大小相同的情况.根据图像大小计算坐标.
This works only if image size is same. Depending on image size calculate coordinates.
这篇关于cocos2d中没有正确检测到CGPath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!