本文整理汇总了C++中setCustomAction函数的典型用法代码示例。如果您正苦于以下问题:C++ setCustomAction函数的具体用法?C++ setCustomAction怎么用?C++ setCustomAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setCustomAction函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: eatTakeDamage
static void eatTakeDamage(Entity *other, int damage)
{
Entity *temp;
if (!(self->flags & INVULNERABLE))
{
setCustomAction(self, &flashWhite, 6, 0, 0);
setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
self->mental--;
enemyPain();
if (self->mental <= 0)
{
self->action = &eatExplode;
}
if (other->type == PROJECTILE)
{
temp = self;
self = other;
self->die();
self = temp;
}
}
}
开发者ID:polluks,项目名称:edgar,代码行数:30,代码来源:blob_boss.c
示例2: upTouch
static void upTouch(Entity *other)
{
int bottomBefore;
if (self->active == TRUE && !(other->flags & FLY))
{
if (other->dirY > 0)
{
bottomBefore = other->y + other->h - other->dirY - 1;
if (bottomBefore < self->y)
{
/* Place the player as close to the solid tile as possible */
other->y = self->y;
other->y -= other->h;
other->standingOn = self;
other->dirY = 0;
other->flags |= ON_GROUND;
}
else
{
setCustomAction(other, &antiGravity, 2, 0, 1);
}
}
else
{
setCustomAction(other, &antiGravity, 2, 0, 1);
}
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:34,代码来源:one_way_door.c
示例3: takeDamage
static void takeDamage(Entity *other, int damage)
{
Entity *temp;
if (!(self->flags & INVULNERABLE))
{
if (strcmpignorecase(other->name, "weapon/wood_axe") == 0)
{
playSoundToMap("sound/item/chop", -1, self->x, self->y, 0);
self->health -= damage;
if (self->health > 0)
{
setCustomAction(self, &flashWhite, 6, 0, 0);
}
else
{
if (self->mental > 0)
{
self->health = self->maxHealth;
self->mental--;
}
else
{
setInfoBoxMessage(60, 255, 255, 255, _("It's out of apples..."));
}
}
}
else
{
playSoundToMap("sound/common/dink", -1, self->x, self->y, 0);
if (other->reactToBlock != NULL)
{
temp = self;
self = other;
self->reactToBlock(temp);
self = temp;
}
damage = 0;
if (other->type != PROJECTILE && prand() % 10 == 0)
{
setInfoBoxMessage(60, 255, 255, 255, _("This weapon is not having any effect..."));
}
}
setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:59,代码来源:apple_tree.c
示例4: iceBlockTakeDamage
void iceBlockTakeDamage(Entity *other, int damage)
{
Entity *temp;
if (self->flags & INVULNERABLE)
{
return;
}
if (strcmpignorecase(other->name, "weapon/pickaxe") == 0)
{
self->damage = 0;
self->die();
}
else if (damage != 0)
{
self->health -= damage;
if (other->type == PROJECTILE)
{
temp = self;
self = other;
self->die();
self = temp;
}
if (self->health > 0)
{
setCustomAction(self, &flashWhite, 6, 0, 0);
/* Don't make an enemy invulnerable from a projectile hit, allows multiple hits */
if (other->type != PROJECTILE)
{
setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
}
if (self->pain != NULL)
{
self->pain();
}
}
else
{
self->damage = 0;
self->die();
}
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:56,代码来源:large_book.c
示例5: entityTakeDamageNoFlinch
void entityTakeDamageNoFlinch(Entity *other, int damage)
{
Entity *temp;
if (self->flags & INVULNERABLE)
{
return;
}
if (damage != 0)
{
self->health -= damage;
if (self->health > 0)
{
setCustomAction(self, &flashWhite, 6, 0, 0);
/* Don't make an enemy invulnerable from a projectile hit, allows multiple hits */
if (other->type != PROJECTILE)
{
setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
}
if (self->pain != NULL)
{
self->pain();
}
}
else
{
self->damage = 0;
if (other->type == WEAPON || other->type == PROJECTILE)
{
increaseKillCount();
}
self->die();
}
if (other->type == PROJECTILE)
{
temp = self;
self = other;
self->die();
self = temp;
}
}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:54,代码来源:entity.c
示例6: entityTakeDamageFlinch
void entityTakeDamageFlinch(Entity *other, int damage)
{
Entity *temp;
if (self->flags & INVULNERABLE)
{
return;
}
if (damage != 0)
{
self->health -= damage;
if (self->health > 0)
{
setCustomAction(self, &helpless, 10, 0, 0);
setCustomAction(self, &invulnerable, HIT_INVULNERABLE_TIME, 0, 0);
if (self->pain != NULL)
{
self->pain();
}
self->dirX = other->face == RIGHT ? 6 : -6;
}
else
{
self->damage = 0;
if (other->type == WEAPON || other->type == PROJECTILE)
{
increaseKillCount();
}
self->die();
}
if (other->type == PROJECTILE)
{
temp = self;
self = other;
self->die();
self = temp;
}
}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:50,代码来源:entity.c
示例7: touch
static void touch(Entity *other)
{
Entity *temp;
if (!(self->flags & INVULNERABLE) && other->type == ITEM && strcmpignorecase(other->name, "item/repellent_spray") == 0)
{
self->mental++;
if (self->mental == 50)
{
self->action = &shudder;
self->targetX = self->x;
self->thinkTime = 300;
if (player.health > 0)
{
setInfoBoxMessage(180, 255, 255, 255, _("Now! Run while it's stunned!"));
}
self->health = 0;
}
else if (self->mental > 50)
{
self->thinkTime = 300;
}
setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
setCustomAction(self, &flashWhite, 6, 0, 0);
}
else if (other->type == PLAYER && self->action == &attack)
{
temp = self;
self = other;
freeEntityList(playerGib());
self = temp;
}
else
{
entityTouch(other);
}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:49,代码来源:huge_spider.c
示例8: riftWait
static void riftWait()
{
self->thinkTime--;
if (self->thinkTime <= 0)
{
stopSound(self->health);
self->action = &riftClose;
self->thinkTime = 20;
}
else
{
if (collision(self->x - self->mental, self->y - self->mental, self->mental * 2, self->mental * 2, player.x, player.y, player.w, player.h) == 1)
{
setCustomAction(&player, &attract, 5, 0, (player.x < (self->x + self->w / 2) ? 2 : -2));
}
if (prand() % 3 == 0)
{
addRiftEnergy(self->x + self->w / 2, self->y + self->h / 2);
}
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:26,代码来源:rampaging_master_tortoise.c
示例9: extend
static void extend()
{
setCustomAction(&player, &helpless, 2, 0, 0);
if (self->dirX == 0)
{
self->dirX = self->face == LEFT ? self->speed : -self->speed;
self->action = &retract;
setEntityAnimation(self, "JUMP");
self->health = 2;
}
else
{
checkToMap(self);
self->mental += fabs(self->dirX);
if (self->mental >= 256)
{
self->dirX = 0;
}
}
self->y = player.y + player.h / 2 - self->h / 2;
}
开发者ID:LibreGames,项目名称:edgar,代码行数:29,代码来源:extend_o_grab.c
示例10: webTouch
static void webTouch(Entity *other)
{
if (other->type == PLAYER && !(other->flags & WRAPPED) && !(other->flags & INVULNERABLE) && other->health > 0)
{
if ((other->flags & BLOCKING) && ((self->dirX > 0 && player.face == LEFT) || (self->dirX < 0 && player.face == RIGHT)))
{
player.dirX = self->dirX < 0 ? -2 : 2;
checkToMap(&player);
setCustomAction(&player, &helpless, 2, 0, 0);
if (playerShield.thinkTime <= 0)
{
playSoundToMap("sound/edgar/block", EDGAR_CHANNEL, player.x, player.y, 0);
playerShield.thinkTime = 5;
}
}
else
{
setPlayerWrapped(120);
}
self->inUse = FALSE;
}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:28,代码来源:large_spider.c
示例11: dieWait
static void dieWait()
{
self->flags |= NO_DRAW;
self->thinkTime--;
if (self->thinkTime <= 0)
{
self->mental = 0;
self->flags |= FLY;
self->flags &= ~NO_DRAW;
self->dirX = 0;
self->dirY = 0;
self->y = self->startY;
self->touch = &entityTouch;
self->action = &entityWait;
setCustomAction(self, &invulnerable, 180, 0, 0);
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:27,代码来源:icicle.c
示例12: riftWait
static void riftWait()
{
int x, y;
self->thinkTime--;
if (self->thinkTime <= 0 || self->head->health <= 0)
{
stopSound(self->health);
self->action = &riftClose;
self->thinkTime = 20;
}
else
{
x = self->x + self->w / 2;
y = self->y + self->h / 2;
if (collision(x - self->speed, y - self->speed, self->speed * 2, self->speed * 2, player.x, player.y, player.w, player.h) == 1)
{
setCustomAction(&player, &attract, 5, 0, (player.x < (self->x + self->w / 2) ? player.speed - 0.25 : -(player.speed - 0.25)));
}
if (prand() % 3 == 0)
{
addRiftEnergy(self->x + self->w / 2, self->y + self->h / 2);
}
}
checkToMap(self);
}
开发者ID:polluks,项目名称:edgar,代码行数:33,代码来源:chaos.c
示例13: activate
static void activate(int val)
{
if (self->head->active == FALSE)
{
runScript("rusted");
}
else
{
self->head->action = &fire;
setEntityAnimation(self->head, "WALK");
self->head->frameSpeed = 1;
setCustomAction(&player, &invulnerableNoFlash, 60, 0, 0);
setPlayerStunned(60);
player.dirX = 12;
player.dirY = -22;
self->head->thinkTime = 120;
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:25,代码来源:catapult.c
示例14: die
static void die()
{
int i;
self->action = ¨
setCustomAction(self, &invulnerableNoFlash, 240, 0, 0);
setEntityAnimation(self, "STUNNED");
self->flags &= ~FLY;
self->dirX = 0;
self->mental = self->x < getMapStartX() + SCREEN_WIDTH / 2 ? 0 : 1;
checkToMap(self);
if (self->flags & ON_GROUND)
{
for (i=0;i<20;i++)
{
addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust");
}
playSoundToMap("sound/common/crash", BOSS_CHANNEL, self->x, self->y, 0);
self->thinkTime = 120;
self->endY = 0;
self->action = &dieFinish;
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:34,代码来源:cave_boss.c
示例15: dieFinish
static void dieFinish()
{
if (self->thinkTime > 0)
{
self->thinkTime--;
setCustomAction(self, &invulnerableNoFlash, 240, 0, 0);
if (self->thinkTime <= 0)
{
fireTrigger(self->objectiveName);
fireGlobalTrigger(self->objectiveName);
}
}
if (self->endY == 1)
{
setEntityAnimation(self, "STAND");
self->thinkTime = 60;
facePlayer();
self->action = &finalAttack;
}
checkToMap(self);
}
开发者ID:LibreGames,项目名称:edgar,代码行数:29,代码来源:cave_boss.c
示例16: takeDamage
static void takeDamage(Entity *other, int damage)
{
Entity *temp;
setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
playSoundToMap("sound/common/dink", -1, self->x, self->y, 0);
if (other->reactToBlock != NULL)
{
temp = self;
self = other;
self->reactToBlock(temp);
self = temp;
}
if (other->type != PROJECTILE && prand() % 10 == 0)
{
setInfoBoxMessage(60, 255, 255, 255, _("This weapon is not having any effect..."));
}
damage = 0;
}
开发者ID:LibreGames,项目名称:edgar,代码行数:26,代码来源:glass_wall.c
示例17: entityDieNoDrop
void entityDieNoDrop()
{
self->damage = 0;
self->health = 0;
if (!(self->flags & INVULNERABLE))
{
self->flags &= ~FLY;
self->weight = fabs(self->originalWeight);
self->flags |= DO_NOT_PERSIST;
self->thinkTime = 60;
setCustomAction(self, &invulnerable, 240, 0, 0);
self->frameSpeed = 0;
self->action = &noItemDie;
fireTrigger(self->objectiveName);
fireGlobalTrigger(self->objectiveName);
}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:27,代码来源:entity.c
示例18: entityDie
void entityDie()
{
self->damage = 0;
self->health = 0;
if (!(self->flags & INVULNERABLE))
{
self->flags &= ~FLY;
self->weight = fabs(self->originalWeight);
self->flags |= DO_NOT_PERSIST;
self->thinkTime = 60;
setCustomAction(self, &invulnerable, 240, 0, 0);
self->frameSpeed = 0;
self->action = &standardDie;
self->damage = 0;
}
}
开发者ID:revcozmo,项目名称:edgar,代码行数:25,代码来源:entity.c
示例19: segmentTakeDamage
static void segmentTakeDamage(Entity *other, int damage)
{
Entity *temp;
if (self->flags & INVULNERABLE)
{
return;
}
if (damage != 0)
{
self->health -= damage;
if (self->health > 0)
{
setCustomAction(self, &flashWhite, 6, 0, 0);
/* Don't make an enemy invulnerable from a projectile hit, allows multiple hits */
if (other->type != PROJECTILE)
{
setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
}
enemyPain();
}
else
{
self->damage = 0;
self->die();
}
if (other->type == PROJECTILE)
{
temp = self;
self = other;
self->die();
self = temp;
}
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:46,代码来源:centipede.c
示例20: takeDamage
static void takeDamage(Entity *other, int damage)
{
Entity *temp;
if (!(self->flags & INVULNERABLE))
{
if (damage < self->health)
{
self->targetY = self->startY;
setCustomAction(self, &flashWhite, 6, 0, 0);
self->action = &retreat;
setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
}
else
{
self->flags &= ~FLY;
self->dirY = ITEM_JUMP_HEIGHT;
self->damage = 0;
if (other->type == WEAPON || other->type == PROJECTILE)
{
increaseKillCount();
}
self->die();
}
if (other->type == PROJECTILE)
{
temp = self;
self = other;
self->die();
self = temp;
}
}
}
开发者ID:LibreGames,项目名称:edgar,代码行数:45,代码来源:spider.c
注:本文中的setCustomAction函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论