当前位置: 首页>>代码示例>>C++>>正文


C++ Shell::setLeft方法代码示例

本文整理汇总了C++中Shell::setLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ Shell::setLeft方法的具体用法?C++ Shell::setLeft怎么用?C++ Shell::setLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shell的用法示例。


在下文中一共展示了Shell::setLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: check


//.........这里部分代码省略.........
                    this->setTop(this->top() + 8);
                }
                this->state_ = FIRE_STATE;
                Level::sharedLevel()->removeDrawable(objt);
                break;
            case COIN:
                game->addCoin();
                Level::sharedLevel()->removeDrawable(objt);
                break;
                
        }
    objb = this->checkBottom();
    //All objects that can hit Mario from the bottom
    if (objb) {
        Shell *nshell;
        switch (objb->objectType()) {
            // if Mario lands on anything solid
            // stop Mario from falling
            case PIPE:
            case OFFQUESTION:
            case BREAKABLE:
            case REGULAR:
            case QUESTION:
                if (this->getYVelocity() < 0) {
                    this->setYVelocity(0.0);
                }
                break;
            // Mario lands on an enemy
            // if Turtle, generate shell
            case TURTLE:
                nshell = new Shell();
                nshell->setTop(objb->top()-8);
                nshell->setRight(objb->right());
                nshell->setLeft(objb->left());
                nshell->setBottom(objb->bottom());
                Level::sharedLevel()->addMovable(nshell);
                //break;
            // if Goomba, kill enemy and 
            // reset jumpCount to half for bounce
            case GOOMBA:
                game->jumpEnemy(1);
                Level::sharedLevel()->removeDrawable(objb);
                this->jumpCount_ = 25;
                this->setYVelocity(2.0);
            case SHELL:
            case ENEMYFIREBALL:
                break;
            // if Mario lands on a reward, increase state accordingly or
            // add points
            case MUSHROOM:
                game->addPowerup();
                Level::sharedLevel()->removeDrawable(objb);
                if (this->state_ == SMALL_STATE) {
                    this->state_ = BIG_STATE;
                    this->setTop(this->top() + 8);
                }
                break;
            // Make Mario invincible for 1000 frames
            case STAR:
                game->addPowerup();
                starCount_ = 1000;
                break;
            case FIREFLOWER:
                game->addPowerup();
                if (state_ == SMALL_STATE)
                {
开发者ID:apeddicord,项目名称:CS330,代码行数:67,代码来源:Mario.cpp

示例2: check


//.........这里部分代码省略.........
            case FIREFLOWER:
                game->addPowerup();
                if (state_ == SMALL_STATE)
                {
                    this->setTop(this->top() + 8);
                }
                this->state_ = FIRE_STATE;
                Level::sharedLevel()->removeDrawable(objt);
                break;
            case COIN:
                game->addCoin();
                Level::sharedLevel()->removeDrawable(objt);
                break;
                
        }
    objb = this->checkBottom();
    //All objects that can hit Mario from the bottom
    if (objb) {
        Shell *nshell;
        switch (objb->objectType()) {
            case PIPE:
            case OFFQUESTION:
            case BREAKABLE:
            case REGULAR:
            case QUESTION:
                if (this->getYVelocity() < 0) {
                    this->setYVelocity(0.0);
                }
                break;
            case TURTLE:
                nshell = new Shell();
                nshell->setTop(objb->top()-8);
                nshell->setRight(objb->right());
                nshell->setLeft(objb->left());
                nshell->setBottom(objb->bottom());
                Level::sharedLevel()->addMovable(nshell);
                //break;
            case GOOMBA:
                game->jumpEnemy(1);
                Level::sharedLevel()->removeDrawable(objb);
                this->jumpCount_ = 25;
                this->setYVelocity(2.0);
            case SHELL:
            case ENEMYFIREBALL:
                break;
            case MUSHROOM:
                game->addPowerup();
                Level::sharedLevel()->removeDrawable(objb);
                if (this->state_ == SMALL_STATE) {
                    this->state_ = BIG_STATE;
                    this->setTop(this->top() + 8);
                }
                break;
            case STAR:
                game->addPowerup();
                starCount_ = 1000;
                break;
            case FIREFLOWER:
                game->addPowerup();
                if (state_ == SMALL_STATE)
                {
                    this->setTop(this->top() + 8);
                }
                this->state_ = FIRE_STATE;
                Level::sharedLevel()->removeDrawable(objb);
                break;
开发者ID:vishusmartishus,项目名称:CS330,代码行数:67,代码来源:Mario.cpp


注:本文中的Shell::setLeft方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。