In order to access any property, synthesized or not, you need an instance of the class:
MainScene *scene = [[MainScene alloc] init];
scene.CakesEaten = 9999;
Note: the latest editions of Xcode do not require @synthesize
, unless you would like to change the name for the variable that is used by default. You can safely remove that line, along with the declaration of the member variable.
The end result should look like this:
@interface MainScene : CCScene
@property (nonatomic, readwrite) int CakesEaten;
@end