2
就我而言,我正在製作一款2D遊戲,相機總是會跟隨我的角色,但會有場景限制,所以當他幾乎在場景邊界附近時,我不得不停止跟隨他。我也必須處理相機的比例,所以我必須決定是否使用CCFollow :: actionWithTarget()或CCCamera。爲什麼我們更喜歡在cocos2d中使用「CCFollow」而不是「CCCamera」?
在CCCamera.h它說:
限制:
- Some nodes, like CCParallaxNode, CCParticle uses world node coordinates, and they won't work properly if you move them (or any of their ancestors)
using the camera.
- It doesn't work on batched nodes like CCSprite objects when they are parented to a CCSpriteBatchNode object.
- It is recommended to use it ONLY if you are going to create 3D effects. For 2D effecs, use the action CCFollow or position/scale/rotate.
最後一句話很有意思,爲什麼只用它的3D效果?似乎CCCamera不是由其製作者推薦的。我知道這是處理相機動作的捷徑,但我不知道爲什麼最好不要在2D遊戲中使用它。
你有沒有找到合適的人來澄清這一點?我有類似的疑問,並且很高興知道你是否解決了這些疑慮。 – mm24 2012-10-29 09:24:12