• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Particles and GUI [Gamemaker 1.4.9999] (Solved)

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:
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);
 

Simon Gust

Member
Does it generally not work or do they just not show up?
You may have to drop adding the view_xivew[0] and view_yview[0] to x and y.
 

Brenden

Member
Does it generally not work or do they just not show up?
You may have to drop adding the view_xivew[0] and view_yview[0] to x and y.
As I have previously mentioned, I did some debugging and moved the part_system_drawit to a regular draw event and it works fine, but it is under the GUI layer which I want it to be above.
When I just have it in the draw GUI event nothing shows up.
 

Brenden

Member
Ah. I solved it, its almost as you said Simon Gust. The particle was set to be crated at the x and y of the view and then moved to mach the GUI placement. Yet the GUI x and y are place differently then in the room. 0,0 is placed at the view x and y so their would be no reason to add the view x and y to the particle, which in part explained why it only worked when I put the drawit code in the draw event. Thanks for the help.
 
Top