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
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这种类并显示在屏幕中。