纯白:自定义精灵类的问题。
cocos2dx吧
全部回复
仅看楼主
level 1
zaslow 楼主
在helloworld h 文件中加入。
class players :public Sprite
{
public:
virtual bool init();
int hp = 10;
CREATE_FUNC(players);
};
在helloworld c文件中
helloworld init里面
brick0 = players::create();
brick0->setTexture("icon.png");
brick0->setPosition(Vec2(200, 200));
this->addChild(brick0, 2, 30);
前面都没啥问题,到最后this addchild()就会出错;
出错位置指向main中 return Application::getInstance()->run();
求指点,该怎么写一个精灵带10点hp这种类并显示在屏幕中。
2016年06月08日 04点06分 1
level 7
addchild参数没报参数过多的错误?
10点hp就是精灵头上加个loadingbar
2016年06月09日 13点06分 3
1