我使用 cocos2d 2.0。我收到一个错误:property 'world' not found on object of type 'ColoredCircleSprite *'
我在 draw 方法中写错了什么?
-(void) draw
{
[super draw];
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
self.world->DrawDebugData();
kmGLPopMatrix();
}
我试着做如图所示:Cocos2D 2.0 OpenGL 错误?
我还看到了另一种绘制方法的方法,我必须self.
从self.world->DrawDebugData();
行中删除,如果这样做,我会收到另一个错误:Use undeclared identifier 'world'
.
那是ColoredCircleSprite.h
代码:
#import "cocos2d.h"
@interface ColoredCircleSprite : CCNode <CCRGBAProtocol, CCBlendProtocol> {
float radius_;
GLubyte opacity_;
ccColor3B color_;
NSUInteger numberOfSegments;
GLfloat *circleVertices_;
ccBlendFunc blendFunc_;
}
@property (nonatomic,readwrite) float radius;
/** Opacity: conforms to CCRGBAProtocol protocol */
@property (nonatomic,readonly) GLubyte opacity;
/** Opacity: conforms to CCRGBAProtocol protocol */
@property (nonatomic,readonly) ccColor3B color;
/** BlendFunction. Conforms to CCBlendProtocol protocol */
@property (nonatomic,readwrite) ccBlendFunc blendFunc;
/** creates a Circle with color and radius */
+ (id) circleWithColor: (ccColor4B)color radius:(GLfloat)r;
/** initializes a Circle with color and radius */
- (id) initWithColor:(ccColor4B)color radius:(GLfloat)r;
- (BOOL) containsPoint:(CGPoint)point;
@end
我只是从 cocos2d-iphone.com 论坛复制并粘贴代码。我真的不知道应该有什么变量以及是否应该有任何变量。
谢谢。