「Make Games With Us」を通じてジョン・コンウェイの「人生のゲーム」の作り方を追ってみました。MainScene.m のステップ メソッドに到達するまで、ほとんどのチュートリアルをたどることができました (サイトへのリンクはこちら)。
- (void)step
{
[_grid evolveStep]
_generationLabel.string = [NSString stringWithFormat:@"%d", _grid.generation];
_populationLabel.string = [NSString stringWithFormat:@"%d", _grid.totalAlive];
}
エラーは同じタイプです。それらは _grid.generation と _grid.totalAlive に現れています。エラーは次のとおりです。
Property 'generation' not found on object of type 'Grid *'
Property 'totalAlive' not found on object of type 'Grid *'
まったく同じ問題を修正する方法についてこのリンクを見ましたが、SpriteBuilder ですべてを正しく保存して公開しました。ユーザーは明らかにそれを解決しましたが、方法がわかりません。
更新: プロパティ宣言の欠落 (Grid.m):
#import "Grid.h"
#import "Creature.h"
// variables that cannot be changed
static const int GRID_ROWS = 8;
static const int GRID_COLUMNS = 10;
@implementation Grid {
NSMutableArray *_gridArray;
float _cellWidth;
float _cellHeight;
int _generation; // This one
int _totalAlive; // This one
}
/*Rest of the methods go here*/
@end
前もって感謝します!