
数字は完全にランダムです。
ちょっとゲームらしくなってきたでしょ。
#ifndef PROJ_ANDROID_CHARACTER_H
#define PROJ_ANDROID_CHARACTER_H
#include "cocos2d.h"
class Character {
public:
    int Hp;
    int MaxHp;
    int Mp;
    int MaxMp;
    int Power;
    int Speed;
    int Magic;
public:
    Character();
    ~Character();
};
#endif //PROJ_ANDROID_CHARACTER_H
#include "Character.h"
Character::Character()
{
    MaxHp = cocos2d::random<int>(0, 100);
    MaxMp = cocos2d::random<int>(0, 100);
    Power = cocos2d::random<int>(0, 100);
    Speed = cocos2d::random<int>(0, 100);
    Magic = cocos2d::random<int>(0, 100);
}
Character::~Character()
{
}
#ifndef PROJ_ANDROID_GAMESTATUS_H
#define PROJ_ANDROID_GAMESTATUS_H
#include "cocos2d.h"
#include "Character.h"
#include <list>
class GameStatus {
private:
    static GameStatus *gameStatus;
public:
    std::list<Character*> *Charactors;
private:
    GameStatus();
    ~GameStatus();
public:
    static GameStatus* GetGameData();
    static void Destroy();
};
#endif //PROJ_ANDROID_GAMESTATUS_H
#include "GameStatus.h"
GameStatus *GameStatus::gameStatus = nullptr;
GameStatus::GameStatus()
{
    Charactors = new std::list<Character*>();
    for(int i = 0; i < 4; i++)
    {
        Character *character = new Character();
        Charactors->push_back(character);
    }
}
GameStatus::~GameStatus()
{
    for(Character *character = Charactors->front(); Charactors->empty() == true; character = Charactors->front())
    {
        delete character;
        Charactors->pop_front();
    }
    delete Charactors;
}
GameStatus * GameStatus::GetGameData()
{
    if(gameStatus == nullptr)
    {
        gameStatus = new GameStatus();
    }
    return gameStatus;
}
void GameStatus::Destroy()
{
    delete gameStatus;
}
    // ステータスウィンドウの配置
    auto xpos = (visibleSize.width - sprite->getContentSize().width * scaleRate) / 2.0;
    float windowScale = 0;
    float windowHeight = 0;
    Sprite *charaStatusWindow[4];
    auto chara = GameStatus::GetGameData()->Charactors->begin();
    for(int i = 0; i < 4; i++)
    {
        charaStatusWindow[i] = Sprite::create("btn02_03_s_bl.png");
        if (charaStatusWindow[i] == nullptr)
        {
            problemLoading("'btn02_03_s_bl.png'");
        }
        else
        {
            if(windowScale == 0 || windowHeight == 0)
            {
                windowHeight = charaStatusWindow[i]->getContentSize().height;
                windowScale = (visibleSize.height / 4) / windowHeight;
            }
            charaStatusWindow[i]->setPosition(Vec2(xpos + origin.x,origin.y + windowHeight * i * windowScale));
            charaStatusWindow[i]->setAnchorPoint(Vec2(0,0));
            charaStatusWindow[i]->setScale(windowScale);
            this->addChild(charaStatusWindow[i], 1);
        }
        auto offset = charaStatusWindow[i]->getContentSize().width / 10.0;
        auto hpLabel = Label::createWithTTF("Hello World", "fonts/msgothic.ttc", 12);
        if (hpLabel == nullptr)
        {
            problemLoading("'fonts/msgothic.ttc'");
        }
        else
        {
            hpLabel->setAnchorPoint(Vec2(0, 1));
            hpLabel->setPosition(Vec2(origin.x + xpos + offset, origin.y + windowHeight * (i + 1) * windowScale));
            this->addChild(hpLabel, 2);
            auto hpStr = String();
            hpStr.appendWithFormat("HP : %d", chara.operator*()->MaxHp);
            hpLabel->setString(hpStr.getCString());
        }
        auto MpLabel = Label::createWithTTF("Hello World", "fonts/msgothic.ttc", 12);
        if (MpLabel == nullptr)
        {
            problemLoading("'fonts/msgothic.ttc'");
        }
        else
        {
            MpLabel->setAnchorPoint(Vec2(0, 1));
            MpLabel->setPosition(Vec2(origin.x + xpos + offset, origin.y + windowHeight * (i + 1) * windowScale - hpLabel->getContentSize().height));
            this->addChild(MpLabel, 2);
            auto mpStr = String();
            mpStr.appendWithFormat("MP : %d", chara.operator*()->MaxMp);
            MpLabel->setString(mpStr.getCString());
        }
        chara++;
    }
ウインドウ周りのクラス設計もちゃんと考えないといけないね。
あと、C++のList型は、他のプログラムのList型の様に使用できなくて、ちょっとめんどい。
完全にイテレータパターンのクラスなので、少々扱いづらい。
慣れるしか無いんだけど。
あと、乱数はcocos-2dxに搭載されているものが使用できます。
C++標準の乱数よりも使いやすいです。
		
		