[Devlog #4] Using particles to display a picture

— Greetings, fellow devs,

I’d like to share a cool effect I found with Game Maker Studio, which can be adapted for many other projects.

To give a little bit of context, in the game, the sonar player has to scan objects, and I wanted to make an image appear progressively on the screen.
I found it worked well by using particles!

The principle is to pick places randomly in a box around the shape we’d like to have, and to create particles only if the place is inside the shape.

1) First, you need to create the particles system you wish. I personally like the spheres, but there are many other possibilities.

global.particlesUI = part_system_create();

part_type_alpha2 (analyzerBlip,1,0);

2) Then, draw the sprite you wish to use (in my case, an octopus silhouette). Tick “Use precise collision”.

3) Create an object with this sprite. Remove the “visible” option.

4) In a step event, create the particles randomly around the object. If the place is inside the shape, create the particle, if not, do nothing.
for (var ii=0;ii<100;ii++){
var randX = 500+random(200);
var randY = 300+random(150);
if collision_point(randX,randY,obj_sonar_analyzer_drawing,true,true){
part_particles_create(global.particlesUI, randX, randY, analyzerBlip, 1);}

5) Test it!

Other ideas:
-making lines for a CRT screen.
-exploding object

Question: Which version of Game Maker to use?
I am using GMS 1.4 but code for GMS2 should be identical.

Question: Do I need one object per sprite?
You can use multiple sprites for the same object. Remember to put an image_speed = 0 in the Create event.
You could even make an animation, although I didn’t test it.

Other questions? Answer here or send me an email at contact@abysscrew.com , I’ll update the questions list here to share it with the community 🙂

Hope it helped some of you!

Captain Pol, out —

Leave a Reply