示例#1
0
//---------------------------------------------------------------------------
AIRandomMoveTank::AIRandomMoveTank(GameManager *mgr, FastBitmap *c, String profile)
: CustomPlayerTank(mgr,c,profile)
{
        Defines d;
        d.Load("userdata\\"+profile);
        int cnt=0;
        movingValues[0]=StrToInt(d.Get("mv_u")); cnt+=movingValues[0];
        movingValues[1]=StrToInt(d.Get("mv_l")); cnt+=movingValues[1];
        movingValues[2]=StrToInt(d.Get("mv_r")); cnt+=movingValues[2];
        movingValues[3]=StrToInt(d.Get("mv_d")); cnt+=movingValues[3];
        movingValuesSum = cnt;
        lasttimeChangedMove = 0;
        changeTime = StrToInt(d.Get("mv_t"));
        ccTime = random(changeTime)+changeTime/2;
        scoreForKill = StrToInt(d.Get("score"));
        team = TEAM_AI;
        type = TYPE_AI_TANK;
}
示例#2
0
//---------------------------------------------------------------------------
CustomPlayerTank::CustomPlayerTank(GameManager *mgr, FastBitmap *c, String profileFilename) : PlayerTank(mgr,c)
{
        Defines profile;
        profile.Load("userdata\\"+profileFilename);
        delete sprite;
        
        SpriteFabric * sf = SpriteFabric::getInstance();
        sprite = sf->SFM_CURRENT(profile.Get("sprite"),context);
        attackCoolDown = StrToInt(profile.Get("as"));
        speed = StrToInt(profile.Get("speed"));
        dmgmin = StrToInt(profile.Get("dmgmin"));
        dmgmax = StrToInt(profile.Get("dmgmax"));
        bulletSpeed = StrToInt(profile.Get("bulletspeed"));
        bulletType = StrToInt(profile.Get("bullettype"));
        maxhp = hp = StrToInt(profile.Get("maxhp"));
        typeResist = StrToInt(profile.Get("typeresist"));
        valueResist = StrToInt(profile.Get("valueresist"));
        pen[0] = StrToInt(profile.Get("concretepen"));
        pen[1] = StrToInt(profile.Get("brickpen"));
        pen[2] = StrToInt(profile.Get("tankpen"));
}
示例#3
0
spriteDesc newSpriteDialog::getSpriteDesc(QString type)
{
    spriteDesc result;
    QDir dir;
    dir.setPath("data/sprites/");
    QStringList filters;
    filters << "*.sprite";
    dir.setNameFilters(filters);
    QStringList files = dir.entryList();
    for (int i=0; i<files.count(); i++)
    {
        QString str = files.at(i);
        Defines d;
        d.Load("data/sprites/"+str);
        if (type == d.Get("registername"))
        {
            result.h = d.Get("h").toInt();
            result.w = d.Get("w").toInt();
            result.animations = d.GetList("animationlist");
            return result;
        }
    }
    return result;
}