• 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!

How to create a firefly effect

sensodyne

Member
Hello,

How to get this fireflys effect?
as in the attached videos
it can probably be done with emitters but how exactly do i do it? It would be good for such skylights to be able to mark their size and put them on the object where they would circulate


move 1




move 2



move 3 - fast forward until 12:00



and move 4 scroll from 1:09 to 1:15



Thank you :)
 

matharoo

manualman
GameMaker Dev.
For the best effect you can do it manually by using instances, or for better performance, a list/array of fireflies that spawn and despawn, with custom animation applied every frame.

You can also do it with particles, but it'll look much simpler. Try this video:
You can create a particle type that constantly scales down, with a direction increase value and perhaps some wiggle. I suggest learning about particle systems and trying it out.
 

sensodyne

Member
For the best effect you can do it manually by using instances, or for better performance, a list/array of fireflies that spawn and despawn, with custom animation applied every frame.

You can also do it with particles, but it'll look much simpler. Try this video:
You can create a particle type that constantly scales down, with a direction increase value and perhaps some wiggle. I suggest learning about particle systems and trying it out.

Thank you very much for the tutorial..Just that I am using the older version of GMS 1.4 and not 2x.
and this tutorial is very different from the examples above ..
 
Well, matharoo provided a few different solutions. He even pointed out "but it'll look much simpler" in relation to particles. Try using instances and a spawner. There's nothing special about a "firefly effect" compared to anything else in relation to using instances. Make the instances move in the way you would like and animate them as you want them to look.
 

sensodyne

Member
Well, matharoo provided a few different solutions. He even pointed out "but it'll look much simpler" in relation to particles. Try using instances and a spawner. There's nothing special about a "firefly effect" compared to anything else in relation to using instances. Make the instances move in the way you would like and animate them as you want them to look.

I looked at the documentation ... yes, there is how to make fireflies like that ... but the problem is how to connect it like this and get this effect ... we set an empty object to the part of the room where we want these particles to be generated .
 

sensodyne

Member
I used the guide on the network ... there was an example with rain built on emitters, but the principle of operation was similar ..

However, I ran into some minor issues ..

I create too many fireflies in the area I mark ... they are too dense ... I would like to get a similar effect as, for example, in this video ...


move



my emitters code looks like this ..


obj_emitersystem

create

GML:
partEmitter = part_emitter_create(particleSystem);
partType = ds_list_create();
partCount = ds_list_create();

destroy

GML:
///cleaning
part_emitter_destroy(particleSystem,partEmitter);
ds_list_clear(partType);
ds_list_clear(partCount);

begin step

GML:
if(ds_exists(partType,ds_type_list))
{
if ds_list_size(partType) > 0 {
part_emitter_region(particleSystem,partEmitter,max(bbox_left,view_xview[0]),min(bbox_right,view_xview[0]+view_wview[0]),max(bbox_top,view_yview[0]),min(bbox_bottom,view_yview[0]+view_hview[0]),ps_shape_rectangle,ps_distr_linear);
for (i=0;i<ds_list_size(partType);i++) {
  part_emitter_burst(particleSystem,partEmitter,ds_list_find_value(partType,i),ds_list_find_value(partCount,i)*((min(bbox_right,view_xview[0]+view_wview[0])-max(bbox_left,view_xview[0]))/32)*((min(bbox_bottom,view_yview[0]+view_hview[0])-max(bbox_top,view_yview[0]))/32));
}
}
}


obj_system

create

GML:
globalvar particleSystem,pFireflies;
particleSystem = part_system_create();
part_system_depth(particleSystem,-20);



pFireflies = part_type_create()
part_type_alpha3(pFireflies,0,.5,0);
part_type_colour1(pFireflies,c_white);
part_type_shape(pFireflies,pt_shape_flare);
part_type_size(pFireflies,0.15,0.15,0,0);
part_type_direction(pFireflies, 0, 359, 1, 20);
part_type_speed(pFireflies, 0.3, 0.3, 0, 0);
part_type_orientation(pFireflies, 0, 359, 0, 20, 1);
part_type_life(pFireflies, room_speed, room_speed * 2);


destroy


GML:
///cleaning after leaving the room of particle effects

part_system_destroy(particleSystem);
part_type_destroy(fireflies);


and the code in the creacion code obj_emitersystem set on the room

GML:
haveParticles(pfireflies,0.3);

scr_haveParticles


GML:
///particle(type,count);
ds_list_add(partType,argument0);
ds_list_add(partCount,argument1);
 
Last edited:

sensodyne

Member
I achieved this effect ... but it is too much ... and it forms as a rectangle.
ok i can change it
ps_shape_rectangle on ps_shape_ellipse
but that's still not the effect I want to get








I would like to get this effect ... but I don't know what values should I change ... to get this effect ..


 

Evanski

Raccoon Lord
Forum Staff
Moderator
I used them for fairies, but basically I have a small white dot as the object sprite thats then blended out and then particles as the main object
 

Director_X

Member
Instead of burdening the system with particles, create a small sprite that simply fades away to transparency.
Have this object have some "glowing" effect on it.
Now randomly create it on screen and a random direction associated with it.
At animation end, simply destroy it.

Simples! ;)
 

sensodyne

Member
everything can use particles, there just draws to the screen through code and not an asset
and instances .. it will not create because I do not even know how to create it ..
I care about the effect I showed in the video below


 

Director_X

Member

sensodyne

Member
Last edited:

Director_X

Member
Hi. The example matches the first video in the first post.

Also, you can change the settings/sprites if you want to create the effect you need. They both work the same way.

Good luck.
 
Top