ZhouWeikuan / cocos2d

cocos2d for android, based on cocos2d-android-0.82, and now ported from cocos2d-iphone 0.99.4. The googlecode address is here: http://code.google.com/p/cocos2d-android-1/ . There are several demos to watch.
610 stars 291 forks source link

CCFollow.action cannot work #73

Open ChenZhongPu opened 10 years ago

ChenZhongPu commented 10 years ago

In the test demo, the Follow Action should make the sprite be centered. However, it didn't work well as expected.

zwang92 commented 10 years ago

There is a bug in org.cocos2d.actions.base CCFollow.java . Modify step routine as following code, then you will find the test demo works as expected.

public void step(float dt) { ... target.setPosition(CGPoint.ccp(CLAMP(tempPos.x,rightBoundary,leftBoundary), CLAMP(tempPos.y,topBoundary,bottomBoundary))); ... }