예제 #1
0
static void moveToTarget()
{
	checkToMap(self);

	if (self->x < self->startX || self->x > self->endX)
	{
		self->x = self->x < self->startX ? self->startX : self->endX;

		self->dirX = 0;

		self->dirY = 0;
	}

	if (self->y < self->startY || self->y > self->endY)
	{
		self->y = self->y < self->startY ? self->startY : self->endY;

		self->dirX = 0;

		self->dirY = 0;
	}

	if (atTarget() || (self->dirX == 0 && self->dirY == 0))
	{
		self->dirX = 0;

		self->dirY = 0;

		self->thinkTime = 60 + prand() % 180;

		self->action = &entityWait;
	}

	lookForPlayer();
}
예제 #2
0
파일: mine.c 프로젝트: LibreGames/tbftss
static void think(void)
{
	self->texture = (self->type == ET_MINE) ? mineNormal : shadowMine;
	
	self->angle += 0.1;
	
	if (self->angle >= 360)
	{
		self->angle -= 360;
	}
	
	self->dx *= 0.99;
	self->dy *= 0.99;
	
	if (self->type == ET_MINE)
	{
		lookForFighters();
	}
	else
	{
		lookForPlayer();
	}
	
	if (self->systemPower < SYSTEM_POWER && battle.stats[STAT_TIME] % 8 < 4)
	{
		playBattleSound(SND_MINE_WARNING, self->x, self->y);
		
		self->texture = mineWarning;
	}
}
예제 #3
0
void RankingDialog::init(const QString &name, const QString &tier)
{
    this->name->setText(name);
    for(int i = 0; i < tierSelection->count(); i++)
    {
        if (tierSelection->itemText(i) == tier) {
            tierSelection->setCurrentIndex(i);
            break;
        }
    }

    emit lookForPlayer(tier, name);
}
예제 #4
0
static void entityWait()
{
	int x, y;
	int midX, midY;

	if (self->thinkTime > 0)
	{
		self->thinkTime--;
	}

	else if (self->thinkTime <= 0)
	{
		midX = self->startX + (self->endX - self->startX) / 2;
		midY = self->startY + (self->endY - self->startY) / 2;

		x = (prand() % 128);
		y = (prand() % 128);

		if (self->x > midX)
		{
			x *= -1;
		}

		if (self->y > midY)
		{
			y *= -1;
		}

		self->targetX = self->x + x;
		self->targetY = self->y + y;

		self->action = &moveToTarget;

		calculatePath(self->x, self->y, self->targetX, self->targetY, &self->dirX, &self->dirY);

		self->dirX *= self->speed;
		self->dirY *= self->speed;

		self->thinkTime = 120;

		self->mental--;

		if (self->mental < 0)
		{
			self->mental = 0;
		}
	}

	lookForPlayer();
}
예제 #5
0
void RankingDialog::searchByName()
{
    emit lookForPlayer(tierSelection->currentText(), name->text());
}