Learn iPhone and iPad cocos2d Game Development [メモ][Cocos2d][4章]




今月日本語版が出る「Learn iPhone and iPad cocos2d Game Development」の原書を読んでいます。
第4章では簡単なすバインダーゲームを作っているのですが、そのソースコードを読んで、わからなかったことをメモしておきます。

cocos2dで作る iPhone&iPadゲームプログラミング cocos2dで作る iPhone&iPadゲームプログラミング
Steffen Itterheim,畑 圭輔,坂本 一樹,加藤 寛人,高丘 知央,株式会社 クイープ

インプレスジャパン 2011-06-24
売り上げランキング : 5411

Amazonで詳しく見る

http://www.apress.com/9781430233039

srandom(time(NULL));

毎回違う乱数にするために、最初にsrandom(time(NULL));を記入してあげるといいみたいです。
http://sarudeki.maiway.jp/forum/topic/439

numberOfRunningActions

実行されているアクションナンバーを返す。
7アクションのうち1シーケンスを実行した場合には1が、2アクションのうち7シーケンスを実行した場合には7が返されます。

sharedApplication

// The game is played only using the accelerometer. The screen may go dark while playing because the player
// won't touch the screen. This method allows the screensaver to be disabled during gameplay.
//このメソッドを使っているときは、ゲームをしている間は、スクリーンセイバーを無効にしている。
-(void) setScreenSaverEnabled:(bool)enabled
{
	UIApplication *thisApp = [UIApplication sharedApplication];
	thisApp.idleTimerDisabled = !enabled;
}

CCTintTo
色を変化させる。
CCTintTo* tint1 = [CCTintTo actionWithDuration:2 red:255 green:0 blue:0];
actionの一つです。

CCARRAY_FOREACH
CCArrayの要素はCCARRAY_FOREACHを使って次のように列挙できる。

CCArrayに以下のように定義しています。


#define CCARRAY_FOREACH(__array__, __object__)													\
	if (__array__)																				\
	for(id *arr = __array__->data->arr, *end = __array__->data->arr + __array__->data->num;		\
			arr < end && ((__object__ = *arr) != nil || true);									\
			arr++)
  1. コメントはまだありません。

  1. トラックバックはまだありません。