我有兩個主要的類在目標C使用cocos2D,DebugZoneLayer和HeroClass。使用Cocos2D可能不是問題的一部分。CGPoint屬性用於從其他類與左值錯誤的類
HeroClass包含一個CGPoint和一個屬性。我在DebugZoneLayer中有一個HeroClass的實例,初始化爲hero = [[HeroClass alloc] init];
我的HeroClass.h縮短了向您展示如何創建CGPoint vel。
@interface HeroClass : CCLayer {
@public CGPoint _vel;
}
@property(assign) CGPoint vel;
在HeroClass.m我綜合我的財產像@synthesize VEL = _vel;
在DebugZoneLayer.m,我可以引用我的hero.vel X或Y就好了,但任何分配一個值hero.vel x或y返回錯誤:左值要求作爲分配
的左操作數
看一看[此最近的問題(http://stackoverflow.com/questions/5860755/)。 – 2011-05-02 21:15:07