Exemplo n.º 1
0
static void dropAttackInit()
{
    int minX, maxX;

    minX = getCameraMinX();
    maxX = getCameraMaxX();

    setEntityAnimation(self, "ATTACK_3");

    self->flags &= ~NO_DRAW;

    self->x = player.x + player.w / 2 - self->w / 2;

    if (self->x < minX)
    {
        self->x = minX;
    }

    else if (self->x + self->w >= maxX)
    {
        self->x = maxX - self->w - 1;
    }

    self->y = self->head->y;

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

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

    self->action = &dropAttack;

    self->thinkTime = 60;

    self->dirY = 0;

    self->touch = &entityTouch;

    checkToMap(self);
}
Exemplo n.º 2
0
static void resumeNormalFunction()
{
	self->thinkTime = 0;

	self->touch = &touch;

	setEntityAnimation(self, "WALK");

	self->animationCallback = &explode;

	self->active = TRUE;

	self->health = 30;

	self->mental = 1;

	self->dirX = 0;

	self->dirY = 0;

	self->action = &startFuse;
}
Exemplo n.º 3
0
static void creditsMove()
{
	self->mental++;

	setEntityAnimation(self, "STAND");

	self->dirX = self->speed;

	checkToMap(self);

	if (self->dirX == 0)
	{
		self->inUse = FALSE;
	}

	if (self->mental != 0 && (self->mental % 300) == 0)
	{
		self->thinkTime = 60;

		self->creditsAction = &electrifyStart;
	}
}
Exemplo n.º 4
0
static void stingAttack()
{
	self->thinkTime--;

	if (self->thinkTime == 0)
	{
		self->dirX = self->face == LEFT ? -24 : 24;

		self->flags |= ATTACKING;

		self->touch = &ramTouch;
	}

	else if (self->thinkTime < 0)
	{
		if (self->dirX == 0)
		{
			shakeScreen(MEDIUM, 15);

			self->frameSpeed = 0;

			self->flags &= ~FLY;

			self->dirY = -4;

			self->dirX = self->face == LEFT ? 4 : -4;

			self->action = &stingAttackPause;

			self->touch = &entityTouch;

			setEntityAnimation(self, "ATTACK_2");

			self->thinkTime = 180;
		}
	}

	checkToMap(self);
}
Exemplo n.º 5
0
static void creditsPurpleMove()
{
	self->mental++;

	setEntityAnimation(self, "STAND");

	self->dirX = self->speed;

	checkToMap(self);

	if (self->dirX == 0)
	{
		self->inUse = FALSE;
	}

	if (self->mental != 0 && (self->mental % 300) == 0)
	{
		self->creditsAction = &spitAttackInit;

		self->dirX = 0;
	}
}
Exemplo n.º 6
0
static void spinAttackStart()
{
	setEntityAnimation(self, "ATTACK_2");

	self->flags |= INVULNERABLE;

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

		if (self->thinkTime == 0)
		{
			self->face = (player.x > self->x ? RIGHT : LEFT);

			self->frameSpeed = 2;

			self->dirY = -8;
		}
	}

	else if (self->thinkTime == 0 && self->flags & ON_GROUND)
	{
		playSoundToMap("sound/enemy/red_grub/spin", -1, self->x, self->y, 0);

		self->speed = self->originalSpeed * 4;

		self->dirX = (self->face == RIGHT ? self->speed : -self->speed);

		self->action = &spinAttack;

		self->creditsAction = &creditsSpinAttack;

		self->thinkTime = 180;

		self->flags |= ATTACKING;
	}

	checkToMap(self);
}
Exemplo n.º 7
0
static void addCursor()
{
	Entity *e = getFreeEntity();

	if (e == NULL)
	{
		showErrorAndExit("No free slots to add a Mastermind Cursor");
	}

	loadProperties("item/jigsaw_puzzle_cursor", e);

	e->x = self->endX;
	e->y = self->endY;

	e->action = &cursorWait;

	e->draw = &drawLoopingAnimationToMap;

	e->head = self;

	setEntityAnimation(e, "STAND");
}
Exemplo n.º 8
0
static void throwApple(int val)
{
	Entity *e;

	if (self->thinkTime <= 0 && game.status == IN_GAME && player.element != WATER)
	{
		setEntityAnimation(self, "WALK");

		self->active = TRUE;

		e = addEntity(*self, player.x + (player.face == RIGHT ? player.w : 0), player.y);

		e->flags &= ~ON_GROUND;

		e->health = 1;

		e->dirX = player.face == LEFT ? -6 : 6;

		e->dirY = ITEM_JUMP_HEIGHT;

		e->action = &doNothing;

		setCustomAction(e, &invulnerableNoFlash, 60, 0, 0);

		playSoundToMap("sound/common/throw", -1, player.x, player.y, 0);

		self->health--;

		if (self->health <= 0)
		{
			self->inUse = FALSE;
		}

		else
		{
			self->thinkTime = 120;
		}
	}
}
Exemplo n.º 9
0
static void instructionMove()
{
	checkToMap(self);

	setCustomAction(&player, &helpless, 5, 0, 0);

	if (self->dirX == 0 && self->dirY == 0)
	{
		processNextInstruction();
	}

	else if (self->x == self->endX && self->y == self->endY)
	{
		runScript("robot_end");

		self->dirX = 0;
		self->dirY = 0;

		self->action = &entityWait;

		setEntityAnimation(self, "STAND");

		activateEntitiesWithRequiredName(self->objectiveName, TRUE);

		centerMapOnEntity(&player);

		setPlayerLocked(FALSE);

		self->health = 2;

		self->target->inUse = FALSE;

		self->target = NULL;

		self->touch = NULL;

		self->activate = NULL;
	}
}
Exemplo n.º 10
0
Entity *addThunderCloud(int x, int y, char *name)
{
	Entity *e = getFreeEntity();

	if (e == NULL)
	{
		showErrorAndExit("No free slots to add a Thunder Cloud");
	}

	loadProperties(name, e);

	e->x = x;
	e->y = y;

	e->action = &init;
	e->touch = &entityTouch;
	e->draw = &drawLoopingAnimationToMap;

	setEntityAnimation(e, "STAND");

	return e;
}
Exemplo n.º 11
0
Entity *addOneWayDoor(int x, int y, char *name)
{
	Entity *e = getFreeEntity();

	if (e == NULL)
	{
		showErrorAndExit("No free slots to add a One Way Door");
	}

	loadProperties(name, e);

	e->x = x;
	e->y = y;

	e->type = KEY_ITEM;

	e->action = &entityWait;

	switch (e->mental)
	{
		case 0:
			e->touch = &touch;
		break;

		case 1:
			e->touch = &upTouch;
		break;

		default:
			e->touch = &downTouch;
		break;
	}

	e->draw = &drawLoopingAnimationToMap;

	setEntityAnimation(e, "STAND");

	return e;
}
Exemplo n.º 12
0
static void finalAttack()
{
	Entity *e;

	if (self->endY == 1)
	{
		self->thinkTime--;

		if (self->thinkTime <= 0)
		{
			setEntityAnimation(self, "GROUND_ATTACK");

			e = addProjectile("boss/fly_boss_slime", self, self->x + (self->face == RIGHT ? self->w : 0), self->y, (self->face == RIGHT ? 7 : -7), 0);

			e->touch = &slimePlayer;

			self->endY = 0;

			self->die = &dieWait;
		}
	}
}
Exemplo n.º 13
0
static void createLightningWaveInit()
{
	Entity *e;

	if (self->endX == 0)
	{
		e = addThunderCloud(self->x, self->y, "enemy/thunder_cloud");

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

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

		e->targetX = self->targetX;
		e->targetY = getMapCeiling(self->x, self->y);

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

		e->flags |= (NO_DRAW|HELPLESS|TELEPORTING|NO_END_TELEPORT_SOUND);

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

		e->head = self;

		e->face = RIGHT;

		setEntityAnimation(e, "STAND");

		e->action = &lightningWaveStart;

		self->endX = 1;
	}

	checkToMap(self);

	hover();
}
Exemplo n.º 14
0
static void returnMove()
{
	checkToMap(self);

	if (self->x == self->startX && self->y == self->startY)
	{
		runScript("robot_end");

		centerMapOnEntity(&player);

		self->action = &entityWait;

		self->dirX = 0;
		self->dirY = 0;

		self->active = FALSE;

		setPlayerLocked(FALSE);

		self->health = 0;

		self->action = &entityWait;

		self->target->flags &= ~NO_DRAW;

		self->target->x = self->x;

		self->target->y = self->y;

		self->target->dirY = ITEM_JUMP_HEIGHT;

		self->target->touch = &keyItemTouch;

		self->target = NULL;

		setEntityAnimation(self, "STAND");
	}
}
Exemplo n.º 15
0
static void creditsMove()
{
	Entity *e;

	self->thinkTime++;

	setEntityAnimation(self, "STAND");

	self->dirX = self->speed;

	checkToMap(self);

	if (self->thinkTime >= 900)
	{
		e = addSnailShell(self->x, self->y, "enemy/snail_shell");

		e->face = self->face;

		e->touch = NULL;

		self->inUse = FALSE;
	}
}
Exemplo n.º 16
0
static void entityWait()
{
	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		if (self->health == 3)
		{
			setEntityAnimation(self, "STAND");

			self->health = 0;
		}

		else
		{
			setEntityAnimationByID(self, self->health);
		}

		self->thinkTime = 0;
	}

	checkToMap(self);
}
Exemplo n.º 17
0
static void addChain()
{
	Entity *e = getFreeEntity();

	if (e == NULL)
	{
		showErrorAndExit("No free slots to add a Magnet Chain");
	}

	loadProperties("item/grabber_chain", e);

	e->type = KEY_ITEM;

	e->face = RIGHT;

	e->action = &chainWait;

	e->draw = &drawChain;

	e->head = self;

	setEntityAnimation(e, "STAND");
}
Exemplo n.º 18
0
static void addRay()
{
	Entity *e = getFreeEntity();

	if (e == NULL)
	{
		showErrorAndExit("No free slots to add a Magnet Ray");
	}

	loadProperties("item/magnet_ray", e);

	e->type = KEY_ITEM;

	e->face = RIGHT;

	e->action = &rayWait;

	e->draw = &drawLoopingAnimationToMap;

	e->head = self;

	setEntityAnimation(e, "STAND");
}
Exemplo n.º 19
0
static void init()
{
	char display[MAX_VALUE_LENGTH];
	Entity *e;

	setEntityAnimation(self, "STAND");

	snprintf(display, MAX_VALUE_LENGTH, "%s_DISPLAY", self->objectiveName);

	e = getEntityByObjectiveName(display);

	if (e == NULL)
	{
		showErrorAndExit("Instruction Machine could not find display %s", display);
	}

	self->target = e;

	self->touch = &touch;
	self->activate = &activate;

	self->action = &entityWait;
}
Exemplo n.º 20
0
static void eggDropMoveToTop()
{
	checkToMap(self);

	if (self->y <= self->targetY)
	{
		self->y = self->targetY;

		self->dirY = 0;

		self->mental = 1 + prand() % 2;

		self->action = &eggDropMove;

		setEntityAnimation(self, "ICE_WALK");

		facePlayer();

		self->targetX = getMapStartX();

		self->targetX += prand() % (SCREEN_WIDTH - self->w);
	}
}
Exemplo n.º 21
0
static void addLegendarySword()
{
	Entity *e;

	e = addPermanentItem("weapon/legendary_sword", 0, 0);

	e->x = self->x;
	e->y = self->y;

	e->flags |= DO_NOT_PERSIST;

	e->action = &swordWait;

	e->touch = NULL;

	e->draw = &drawLoopingAnimationToMap;

	e->head = self;

	setEntityAnimation(e, "STICK_IN_CHAOS");

	self->action = &initialise;
}
Exemplo n.º 22
0
static void lightningCageTeleportAway()
{
	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		setEntityAnimation(self, "STAND");

		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->target->layer = MID_GROUND_LAYER;

		self->action = &attackFinished;
	}

	checkToMap(self);

	becomeTransparent();
}
Exemplo n.º 23
0
static void createVine()
{
	Entity *e = getFreeEntity();

	if (e == NULL)
	{
		showErrorAndExit("No free slots to add a Ceiling Snapper Vine");
	}

	loadProperties("enemy/ceiling_snapper_vine", e);

	e->type = ENEMY;

	e->face = self->face;

	e->action = &vineWait;

	e->draw = &drawVine;

	e->head = self;

	setEntityAnimation(e, "STAND");
}
Exemplo n.º 24
0
static void init()
{
	switch (self->mental)
	{
		case 1:
			setEntityAnimation(self, "WALK");

			self->action = &walkAround;
		break;

		case 2:
			self->action = &dropWait;
		break;

		case 3:
			self->action = &flyStart;
		break;

		default:
			self->action = &flyAround;
		break;
	}
}
Exemplo n.º 25
0
static void scytheCreditsMove()
{
	self->face = self->head->face;

	setEntityAnimation(self, getAnimationTypeAtIndex(self->head));

	if (self->face == LEFT)
	{
		self->x = self->head->x + self->head->w - self->w - self->offsetX;
	}

	else
	{
		self->x = self->head->x + self->offsetX;
	}

	self->y = self->head->y + self->offsetY;

	if (self->head->inUse == FALSE)
	{
		self->inUse = FALSE;
	}
}
Exemplo n.º 26
0
static void stompAttackInit()
{
	int i;
	Entity *e;

	setEntityAnimation(self, "STOMP_READY");

	self->weight = 0.5;

	self->dirY = -8;

	self->action = &stompAttackRise;

	for (i=0;i<30;i++)
	{
		e = addSmoke(0, 0, "decoration/dust");

		if (e != NULL)
		{
			e->x = self->x + prand() % self->w;
			e->y = self->y + self->h;

			e->dirX = (10 + prand() % 30);

			e->dirX /= 10;

			e->y -= prand() % e->h;

			if (e->x < self->x + self->w / 2)
			{
				e->dirX *= -1;
			}
		}
	}

	checkToMap(self);
}
Exemplo n.º 27
0
static void init()
{
	Entity *e;

	if (self->mental == 0)
	{
		e = getFreeEntity();

		if (e == NULL)
		{
			showErrorAndExit("No free slots to add the Soul Merger Control Panel Energy Bar");
		}

		loadProperties("boss/awesome_boss_energy_bar", e);

		e->action = &energyBarWait;

		e->draw = &energyBarDraw;

		e->type = ENEMY;

		e->head = self;

		setEntityAnimation(e, "STAND");

		self->action = &entityWait;

		self->target = getEntityByObjectiveName(self->requires);

		if (self->target == NULL)
		{
			showErrorAndExit("Control Panel cannot find Soul Merger %s", self->requires);
		}

		self->activate = &activate;
	}
}
Exemplo n.º 28
0
Entity *addJigsawPuzzle(int x, int y, char *name)
{
	Entity *e = getFreeEntity();

	if (e == NULL)
	{
		showErrorAndExit("No free slots to add a Jigsaw Puzzle");
	}

	loadProperties(name, e);

	e->x = x;
	e->y = y;

	e->type = KEY_ITEM;

	e->action = &init;

	e->draw = &drawLoopingAnimationToMap;

	setEntityAnimation(e, "STAND");

	return e;
}
Exemplo n.º 29
0
static void teleportPlayer()
{
	int frame;
	float timer, x, y;

	if (self->target != NULL)
	{
		getCheckpoint(&x, &y);

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

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

		self->target->flags |= (NO_DRAW|HELPLESS|TELEPORTING);

		playSoundToMap("sound/common/teleport", (self->target->type == PLAYER ? EDGAR_CHANNEL : -1), self->target->x, self->target->y, 0);

		self->target = NULL;
	}

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		frame = self->currentFrame;
		timer = self->frameTimer;

		setEntityAnimation(self, "STAND");

		self->currentFrame = frame;
		self->frameTimer = timer;

		self->action = strcmpignorecase("enemy/blue_scanner", self->name) == 0 ? &closedEyeMove : &lookForPlayer;
	}
}
Exemplo n.º 30
0
static void stunFinish()
{
	self->thinkTime--;

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

		if (self->health <= 500)
		{
			self->endX = 3;
		}

		else if (self->health <= 1000)
		{
			self->takeDamage = NULL;

			self->endX = 1;
		}

		else
		{
			self->takeDamage = NULL;

			self->endX = 0;
		}

		setEntityAnimation(self, "STUN_WAKE");

		self->thinkTime = 60;

		self->action = &stunWake;
	}

	checkToMap(self);
}