タグ

2013年1月2日のブックマーク (2件)

  • cocos2dサンプル:ActionTestの内容(1) « ITASSIST

    cocos2dのサンプルを勉強がてら読みといていくメモです。テストコードのActionTestを読んでいってみます。全体の流れは他のテストと同じみたいなので個別の部分を読んでみます。 ActionTest.hを見る CCLayerを継承したActionDemoクラスが宣言され、それを継承した形で幾つかのテスト用のクラスが用意されている。 ActionDemoクラスにはCCSprite型のメンバ変数が用意されていて、共通で利用するスプライトを保持する用になっている。 ActionDemoクラスにはcenterSpritesメソッドが宣言されていて(ActionTest.mを見るともう一つalignSpritesLeftメソッドもある)スプライトの一の初期化をテストにあわせて実施する内容が書かれている。 ざっと目を通すとこんな感じです。 ActionTest.mを見てゆく ActionDemo

  • How to Animate Sprites in cocos2d

    One of the most frequently asked questions I see about cocos2d for iPhone is “how do you animate sprites?”. This was also one of the first questions we had when developing Addicus. It’s actually quite simple to do using cocos2d’s CCSpriteSheet, CCSprite and CCAnimation classes. These classes take a texture atlas and switch between frames at regular intervals. In other words: animation! Here is how