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


C++ playSoundToMap函数代码示例

本文整理汇总了C++中playSoundToMap函数的典型用法代码示例。如果您正苦于以下问题:C++ playSoundToMap函数的具体用法?C++ playSoundToMap怎么用?C++ playSoundToMap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: touch

static void touch(Entity *other)
{
	Entity *e;

	pushEntity(other);

	if (other->standingOn == self)
	{
		if (self->thinkTime < 5)
		{
			playSoundToMap("sound/item/inflate", -1, self->x, self->y, 0);

			self->health++;
		}

		if (self->health == 3)
		{
			if (self->thinkTime < 5)
			{
				e = addBubble(self->x, self->y, "item/bubble");

				e->x = self->face == LEFT ? getLeftEdge(self) : getRightEdge(self);

				e->x += self->face == LEFT ? -e->w : e->w;

				e->y = self->y + self->h / 2 - e->h / 2;

				e->dirX = self->face == LEFT ? -e->speed : e->speed;
			}

			self->thinkTime = 60;
		}

		else if (self->health > 3)
		{
			self->health = 3;

			self->thinkTime = 60;
		}

		else
		{
			self->thinkTime = 10;
		}

		setEntityAnimationByID(self, self->health + 3);
	}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:48,代码来源:bubble_machine.c

示例2: superFireballAttackInit

static void superFireballAttackInit()
{
    facePlayer();

    playSoundToMap("sound/common/spell", BOSS_CHANNEL, self->x, self->y, 0);

    self->flags &= ~NO_DRAW;
    addParticleExplosion(self->x + self->w / 2, self->y + self->h / 2);
    self->action = &superFireballAttack;

    self->touch = &entityTouch;

    self->thinkTime = -1;

    self->head->mental = 0;
}
开发者ID:carriercomm,项目名称:edgar,代码行数:16,代码来源:awesome_boss.c

示例3: soulStealInit

static void soulStealInit()
{
	self->flags |= NO_DRAW;

	addParticleExplosion(self->x + self->w / 2, self->y + self->h / 2);

	playSoundToMap("sound/common/spell", -1, self->x, self->y, 0);

	self->thinkTime = 30;

	self->action = &soulStealMoveToPlayer;

	checkToMap(self);

	becomeTransparent();
}
开发者ID:LibreGames,项目名称:edgar,代码行数:16,代码来源:azriel.c

示例4: takeDamage

static void takeDamage(Entity *other, int damage)
{
	Entity *temp;

	if (!(self->flags & INVULNERABLE))
	{
		/* Can't be hurt if not facing the player unless using pickaxe */

		if (self->face == other->face)
		{
			if (strcmpignorecase(other->name, "weapon/pickaxe") != 0)
			{
				playSoundToMap("sound/common/dink", -1, self->x, self->y, 0);

				setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);

				if (other->reactToBlock != NULL)
				{
					temp = self;

					self = other;

					self->reactToBlock(temp);

					self = temp;
				}

				if (prand() % 10 == 0)
				{
					setInfoBoxMessage(60, 255, 255, 255, _("This weapon is not having any effect..."));
				}

				damage = 0;
			}

			else
			{
				entityTakeDamageNoFlinch(other, damage * 5);
			}
		}

		else
		{
			entityTakeDamageNoFlinch(other, damage);
		}
	}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:47,代码来源:snail.c

示例5: shotAttack

static void shotAttack()
{
    Entity *e;

    self->thinkTime--;

    if (self->thinkTime <= 0)
    {
        playSoundToMap("sound/boss/snake_boss/snake_boss_shot", BOSS_CHANNEL, self->x, self->y, 0);

        if (prand() % 4 == 0 && self->startX == 0)
        {
            e = addProjectile("boss/snake_boss_special_shot", self, self->x + self->w / 2, self->y + self->h / 2, (self->face == RIGHT ? 7 : -7), 0);

            e->action = &specialShotMove;

            e->reactToBlock = &specialShotBlock;

            self->startX = 1;
        }

        else
        {
            e = addProjectile("boss/snake_boss_normal_shot", self, self->x + self->w / 2, self->y + self->h / 2, (self->face == RIGHT ? 7 : -7), 0);

            e->reactToBlock = &bounceOffShield;
        }

        e->y -= e->h / 2;

        self->x += (self->face == LEFT ? 10 : -10);

        self->maxThinkTime--;

        if (self->maxThinkTime <= 0)
        {
            self->action = &attackFinished;
        }

        else
        {
            self->thinkTime = 10;
        }
    }

    alignBodyToHead();
}
开发者ID:carriercomm,项目名称:edgar,代码行数:47,代码来源:snake_boss.c

示例6: walk

static void walk()
{
	if (self->active == FALSE)
	{
		self->flags &= ~ATTACKING;

		self->damage = 0;

		setEntityAnimation(self, "STAND");

		checkToMap(self);
	}

	else
	{
		self->damage = 1;

		self->flags |= ATTACKING;

		setEntityAnimation(self, "WALK");

		if (self->offsetX != 0)
		{
			if (self->maxThinkTime == 0)
			{
				playSoundToMap("sound/enemy/centurion/walk", -1, self->x, self->y, 0);

				self->maxThinkTime = 1;
			}

			self->dirX = 0;
		}

		else
		{
			self->maxThinkTime = 0;
		}

		checkToMap(self);

		if (self->offsetX != 0)
		{
			self->dirX = (self->face == RIGHT ? self->speed : -self->speed);
		}
	}
}
开发者ID:polluks,项目名称:edgar,代码行数:46,代码来源:gold_centurion.c

示例7: recharge

static void recharge()
{
	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		self->health++;

		setChargeState();

		playSoundToMap("sound/item/charge_beep", -1, self->x, self->y, 0);

		self->thinkTime = 180;
	}

	checkToMap(self);
}
开发者ID:revcozmo,项目名称:edgar,代码行数:17,代码来源:tesla_charger.c

示例8: entityWait

static void entityWait()
{
	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		playDefaultBossMusic();

		playSoundToMap("sound/boss/boulder_boss/roll", BOSS_CHANNEL, self->x, self->y, -1);

		setEntityAnimation(self, "WALK");

		self->action = &chasePlayer;

		self->thinkTime = 1;
	}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:17,代码来源:boulder_boss_2.c

示例9: fireDropMoveAbovePlayer

static void fireDropMoveAbovePlayer()
{
	if (self->face == RIGHT)
	{
		self->targetX = player.x - self->offsetX + player.w / 2;
	}

	else
	{
		self->targetX = player.x - (self->w - self->offsetX) + player.w / 2;
	}

	if (abs(self->x - self->targetX) <= abs(self->dirX))
	{
		self->x = self->targetX;

		self->dirX = 0;

		self->thinkTime = 3;

		if (player.health > 0)
		{
			playSoundToMap("sound/enemy/fireball/fireball", BOSS_CHANNEL, self->x, self->y, 0);

			self->mental = 10;

			setEntityAnimation(self, "FIRE_ATTACK_DOWN");

			self->action = &fireDrop;
		}

		else
		{
			setEntityAnimation(self, "FIRE_ATTACK_DOWN");
		}
	}

	else
	{
		self->dirX = self->targetX < self->x ? -player.speed * 2 : player.speed * 2;

		setEntityAnimation(self, "FIRE_WALK");
	}

	checkToMap(self);
}
开发者ID:LibreGames,项目名称:edgar,代码行数:46,代码来源:cave_boss.c

示例10: move

static void move()
{
	moveLeftToRight();

	hover();

	self->health--;

	if (self->health <= 0)
	{
		playSoundToMap("sound/enemy/ghost/ghost", -1, self->x, self->y, 0);

		self->health = (6 + prand() % 10) * 60;
	}

	self->box.h = self->endY - self->y;
}
开发者ID:polluks,项目名称:edgar,代码行数:17,代码来源:ghost.c

示例11: sprayRepellent

static void sprayRepellent(int val)
{
	Entity *e;

	if (self->thinkTime <= 0 && game.status == IN_GAME && player.element != WATER)
	{
		e = getFreeEntity();

		if (e == NULL)
		{
			showErrorAndExit("No free slots to add Repellent Spray");
		}

		loadProperties("item/repellent_spray", e);

		e->x = player.x + (player.face == RIGHT ? player.w : 0);
		e->y = player.y + player.h / 2;

		setEntityAnimation(e, "STAND");

		e->x -= player.face == RIGHT ? e->box.x : e->box.x + e->box.w;

		e->y -= e->h / 2;

		e->type = ITEM;

		e->face = RIGHT;

		e->action = &sprayMove;
		e->touch = &sprayTouch;

		e->draw = &drawLoopingAnimationToMap;

		e->active = FALSE;

		self->thinkTime = self->maxThinkTime;

		e->dirX = player.face == RIGHT ? 2 + player.speed : -2 - player.speed;

		e->thinkTime = 30;

		e->flags |= DO_NOT_PERSIST;

		playSoundToMap("sound/item/spray", -1, player.x, player.y, 0);
	}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:46,代码来源:repellent.c

示例12: drop

static void drop()
{
	if (self->flags & ON_GROUND)
	{
		self->thinkTime = 30;

		playSoundToMap("sound/common/crash", -1, self->x, self->y, 0);

		shakeScreen(STRONG, self->thinkTime / 2);

		addDust();

		self->action = &entityWait;
	}

	checkToMap(self);
}
开发者ID:revcozmo,项目名称:edgar,代码行数:17,代码来源:boulder_boss_2.c

示例13: smallTouch

static void smallTouch(Entity *other)
{
	if (other->type == PLAYER && other->dirY > 0)
	{
		self->touch = &entityTouch;

		playSoundToMap("sound/enemy/splitter/splat", -1, self->x, self->y, 0);

		setEntityAnimation(self, "DIE");

		self->thinkTime = 120;

		self->action = &smallDie;

		self->dirX = 0;
	}
}
开发者ID:polluks,项目名称:edgar,代码行数:17,代码来源:splitter.c

示例14: createElectricity

static void createElectricity()
{
	Entity *e = getFreeEntity();

	if (e == NULL)
	{
		showErrorAndExit("No free slots to add Tortoise electricity");
	}

	loadProperties("enemy/tortoise_electricity", e);

	playSoundToMap("sound/enemy/tortoise/tortoise_electric", -1, self->x, self->y, 0);

	setEntityAnimation(e, "STAND");

	e->action = &doElectricity;

	e->creditsAction = &doElectricity;

	e->touch = &entityTouch;

	e->takeDamage = &takeDamage;

	e->draw = &drawLoopingAnimationToMap;

	e->target = self;

	e->face = self->face;

	e->x = self->x;

	e->y = self->y;

	self->target = e;

	self->frameSpeed = 1;

	setEntityAnimation(self, "ATTACK_1");

	self->action = &electrify;

	self->creditsAction = &electrify;

	self->thinkTime = 120;
}
开发者ID:polluks,项目名称:edgar,代码行数:45,代码来源:lightning_tortoise.c

示例15: spikeRise

static void spikeRise()
{
	Entity *e;

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		if (self->y > self->startY)
		{
			self->y -= self->speed * 2;
		}

		else
		{
			playSoundToMap("sound/common/crumble", BOSS_CHANNEL, self->x, self->y, 0);

			shakeScreen(MEDIUM, 15);

			e = addSmallRock(self->x, self->y, "common/small_rock");

			e->x += (self->w - e->w) / 2;
			e->y += (self->h - e->h) / 2;

			e->dirX = -3;
			e->dirY = -8;

			e = addSmallRock(self->x, self->y, "common/small_rock");

			e->x += (self->w - e->w) / 2;
			e->y += (self->h - e->h) / 2;

			e->dirX = 3;
			e->dirY = -8;

			self->y = self->startY;

			self->health = 15;

			self->thinkTime = 120;

			self->action = &spikeWait;
		}
	}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:45,代码来源:azriel.c


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