示例#1
0
void MOC_move(MotorHandle *handle, MOTOR_DIR direction, uint8_t speed)
{
    handle = handle;
    setMoving(false);
    setDirection(direction);
    setSpeed(speed);
    setMoving(true);
}
void LeprechaunController::onCaneHit(float caneHitTime)
{
	setMoving(0);
	setBeginFlag(LeprechaunFlag::caneHit, true);
	setFlag(LeprechaunFlag::carryingPig, false);

	timers[TimerType::caneHit] = caneHitTime;
}
void LeprechaunController::onKick(const Vector3& flyVelocity)
{
	setMoving(0);
	setBeginFlag(LeprechaunFlag::flying, true);
	setFlag(LeprechaunFlag::carryingPig, false);

	this->flyVelocity = flyVelocity;
}
示例#4
0
void BuddyPlayer::deathReset(){
    setY(200);
    spawn_time = SPAWN_TIME;
    setMoving(true);
    setStatus(Status_Falling);
    setHealth(getMaxHealth());
    setDeath(0);
    animation_current = getMovement("idle");
}
示例#5
0
    void Paddle::reset() {
        setWidth(60);
        setHeight(10);

        setMoving(false);
        setDirection(Model::Direction::Right);
        setPositionRange(255, 544 - getWidth());
        setPosition(glm::vec2((_positionRange.y + _positionRange.x) / 2.0f, 50.0f - _height));
    }
示例#6
0
void cEntityAvatarTest::update(float elapsedtime)
{
	cEntityMoverTest::update(elapsedtime);
	if (_getInputSystem()->isRButtonDown())
	{
		_getSceneMgr()->pickTerrain();
		setDestPos(_getPick()->getPickPos());
		setMoving(true);
	}
}
示例#7
0
bool NPC::returnToInitialPosition ()
{
	static const float gap = 0.1f;
	const float xPos = getPos().x;
	if (!Between(xPos, _initialPosition.x - gap, _initialPosition.x + gap)) {
		setMoving(_initialPosition);
		return false;
	}
	return true;
}
示例#8
0
void MapTilesFrame::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton)
    {
        timeToGo = 4;
        setMoving(true);

        dragPosition = QPoint(event->x(), this->height() - event->y());
        event->accept();
    }
}
示例#9
0
void Enemy::update(float timeStep)
{
	setMoving(false);
	for (auto& e : getManager()->getAll<Player>()) {
		Player* p = reinterpret_cast<Player*>(e);
        if (p->isMoving() && !p->isDead()) {
			setMoving(true);
            break;
        }
    }

    if (!isMoving()) return;

    //Update target depending on players movement and deadness.
    updateTarget();
    if (currentTarget == NULL) return;

    //Determine direction of enemy so correct sprite is drawn.
    updateDirection();

    //Movement phase
    updateMovement(timeStep);

}
示例#10
0
MapTilesFrame::MapTilesFrame(QWidget *parent) :
    QFrame(parent),
    ui(new Ui::MapTilesFrame)
{
    ui->setupUi(this);

    connect(this, SIGNAL(movingStatusChanged(bool)),
            this, SLOT(updateMouseCursor(bool)));
    connect(this, SIGNAL(viewportCoordinateChanged(QPoint,QPoint)),
            this, SLOT(update()));
    connect(this, SIGNAL(scaleLevelChanged(const QPoint&,int,int)),
            this, SLOT(adjustViewportOnZoom(const QPoint&,int,int)));

    connect(&tileProvider, SIGNAL(mapTypeChanged(QString)), this, SLOT(update()));
    connect(&tileProvider, SIGNAL(dataSourceChanged(DataSource)), this, SLOT(update()));
    connect(&tileProvider, SIGNAL(serverAddressChanged(QString)), this, SLOT(update()));
    connect(&tileProvider, SIGNAL(tileFileTypeChanged(QString)), this, SLOT(update()));
    connect(&tileProvider, SIGNAL(readyTile(QString)), this, SLOT(update()));


//    connect(this, SIGNAL(scaleLevelChanged(QPoint,int,int)),
//            this,SLOT(setAppropriateSize()));

    //mapFilesPath = QCoreApplication::applicationDirPath() + "/map";

    tileWidth = 375;
    tileHeight = 250;

    for(int i = 1; i <= MAX_LEVEL; i++)
    {
        scaleMaps[i].width = 2 * i * tileWidth;
        scaleMaps[i].height = 2 * i * tileHeight;
    }

    biggerMapRect = new QImage();
    //biggerMapRect = QImage(9999, 9999, QImage::Format_RGB16);

    m_viewportCoordinate = QPoint(0,height());
    //setViewportCoordinate(QPoint(0,height()));
    setMoving(false);

    //先设置scaleLevel为一个不存在的值 0 ,然后调用zoomIn使视口放缩级别调整到到最小可视级别
    m_scaleLevel = 1;
    //zoomIn();

    setViewportCoordinate(QPoint(0,height()));

}
示例#11
0
void MOC_stop(MotorHandle *handle)
{
    handle = handle;
    setMoving(false);
    setSpeed(0);
}
示例#12
0
void NPC::setMoving (gridCoord x)
{
	setMoving(b2Vec2(x, getPos().y));
}
示例#13
0
void MapTilesFrame::mouseReleaseEvent(QMouseEvent *event)
{
    Q_UNUSED(event);
    setMoving(false);
    event->accept();
}