Brenden
Member
My goal is to have a particle effect that is drawn on top of the GUI layer or just in the GUI layer drawn last. "What I have achieved/done" I have and object that creates the particle type and its properties, then creates a particle system and sets the part_system_automatic_draw to false. This all happens in the create event. In the draw GUI event I draw some sprites and text first and then call part_system_drawit to hopfully draw the particles of that system to the GUI layer. That code seemed to not work. I did some debugging and moved the part_system_drawit to a regular draw event and it works fine, but it is still under the GUI layer. Here is my code:
Create event:
Draw GUI event:
Create event:
Code:
global.magicBarPart = part_type_create()
part_type_sprite(global.magicBarPart , sMagicMeeterInside, 0, 0, 1);
part_type_life(global.magicBarPart,room_speed/3,room_speed/2);
part_type_size(global.magicBarPart,1,0.9,-0.01,-0.01);
part_type_scale(global.magicBarPart, 1, 1);
part_type_colour1(global.magicBarPart, c_white);
part_type_alpha2(global.magicBarPart, 1, 0);
part_type_speed(global.magicBarPart, 2.40, 2.40, 0, 0.1);
part_type_direction(global.magicBarPart, 45, 135, 0, 20);
part_type_orientation(global.magicBarPart, 0, 0, 0, 0, 0);
part_type_blend(global.magicBarPart, 0);
part_type_gravity(global.magicBarPart, 0.2, 270);
global.magicBarPartSys = part_system_create()
part_system_automatic_draw(global.magicBarPartSys, false);
Draw GUI event:
Code:
draw_set_halign(fa_left);
draw_set_color(c_white);
if (barStart<4.95){
barStart+=0.05
}else{
barStart=0
}
var xx = 10;
var yy = 38;
draw_sprite(sMagicItem,1,xx+28,view_hport[0]-yy-22);
draw_sprite(sMagicMeeter,1,xx,view_hport[0]-22);
for (var i=magic; i>0; i--){
if (i==magic){
draw_sprite(sMagicMeeterInsideEnd,floor(barStart),xx+4+i,view_hport[0]-22+4);
if (magicPart==1){
part_particles_create(global.magicBarPartSys,xx+4+i-1+view_xview[0],view_hport[0]-22+4+view_yview[0],global.magicBarPart,oAvitarGun.magicUse);
magicPart=0
}
}
draw_sprite(sMagicMeeterInside,floor(barStart),xx+4+i-1,view_hport[0]-22+4);
}
draw_sprite(sMagicMeeter,0,xx,view_hport[0]-22);
part_system_drawit(global.magicBarPartSys);