Пример #1
0
//
// The event handler for the group.
//
// @Param ev - Allegro event variable
//
void AI_Group::EventHandler(ALLEGRO_EVENT &ev)
{
	// Handler for pickups
	drops.Event_Handler(ev);


	// Spawn the boss when SPAWN_BOSS_EVENT emits. Only one boss is allowed per group.
	if (ev.type == SPAWN_BOSS_EVENT && !BossActive)
		SpawnBoss(ev.user.data1, ev.user.data2);
	// Spawn a pickup when an AI is killed
	else if (ev.type == AI_KILLED_EVENT || ev.type == BOSS_KILLED_EVENT)
		drops.SpawnObjectRandom(AVec2i(ev.user.data1, ev.user.data2), 25);
}
 AVec2i   operator-() const                    { return AVec2i(-m_x, -m_y); }
 AVec2i   operator/(f32 inv_scale) const       { return AVec2i(a_round(f32(m_x) / inv_scale), a_round(f32(m_y) / inv_scale)); }
 AVec2i   operator*(f32 scale) const           { return AVec2i(a_round(f32(m_x) * scale), a_round(f32(m_y) * scale)); }
 AVec2i   operator-(const AVec2i & vec) const  { return AVec2i(m_x - vec.m_x, m_y - vec.m_y); }
 AVec2i   operator+(const AVec2i & vec) const  { return AVec2i(m_x + vec.m_x, m_y + vec.m_y); }