我正在尝试在 java 中为 cocos2d for android 进行共谋检测,这是我拥有的代码
float oldx = player.getPosition().x;
float oldy = player.getPosition().y;
if((player.getPosition().y + player.getContentSize().height > building1.getPosition().y) &&
(player.getPosition().y < building1.getPosition().y + building1.getContentSize().height) &&
(player.getPosition().x + player.getContentSize().width > building1.getPosition().x) &&
(player.getPosition().x < building1.getPosition().x + building1.getContentSize().width))
{
player.setPosition(CGPoint.ccp(oldx, oldy));
}
但由于某种原因它不起作用......为什么?