1 #include "pe_bubble_expl.h"
2 #include "resources.h"
3 #include "background.h"
4 
5 extern Layouts *g_layouts;
6 
PE_Bubble_Explosion(vec2 const & pos)7 PE_Bubble_Explosion::PE_Bubble_Explosion(vec2 const& pos) :
8 	ParticleEffect(pos,2000.0,300,3.0,&g_resources.texture_cross,300)
9 {
10 }
11 
update_single_particle(Particle & p,float delta_t,float p_time)12 void PE_Bubble_Explosion::update_single_particle(Particle& p,float delta_t,float p_time)
13 {
14 	p.cur_pos += (p.cur_vector * p.cur_speed *((3.0-p_time))) * delta_t;
15 
16 	p.cur_size += 0.01 * delta_t;
17 
18   if (p.cur_speed[0]>0.01)
19     p.cur_speed[0] -= 0.05 * delta_t;
20 
21   if (p.cur_speed[1]>0.01)
22     p.cur_speed[1] -= 0.05 * delta_t;
23 
24 	p.cur_color[3] = 1.1-p_time*2.0;
25 
26 	if (p.cur_color[3]<0.01)
27 		p.alive = false;
28 }
29 
emit_single_particle(Particle & p)30 void PE_Bubble_Explosion::emit_single_particle(Particle& p)
31 {
32 	p.cur_pos = m_pos + vec2(RAND_0_1 * 0.005f,RAND_0_1 * 0.005f);
33 	p.cur_speed = vec2(0.01+RAND_0_1*0.04,0.01+RAND_0_1*0.04);
34 	p.cur_vector = normalized(vec2((RAND_0_1*2.0-1.0),(RAND_0_1*2.0-1.0)));
35 
36 //	p.cur_size = 0.001;
37 	p.cur_size = 0.004;
38 //	p.cur_color = vec4(0.0,0.0,0.0,1.0);
39 	p.cur_color = vec4(1.0,1.0,1.0,1.0);
40 }
41