slaanevil Posted September 11, 2017 Share Posted September 11, 2017 Dear community: We are learning about phaser and we have a doubt for this forum. We are trying to develop a simple shoot game with a plane and enemies. The goal is that when a enemy is killed, a fire animation will be showed. We did this with a spritesheet and the result is good but we want to improve the quality with this filter: https://phaser.io/examples/v2/filters/fireball The problem is that we can't move the fireball effect over each enemy. The fire is always in the same position (left-bottom corner), and we can not change it. Probably the problem is the opengl code but we are not sure. Anyone can add this fireball effect to be showed when the enemy is killed? I thing that this code will be useful for the developers as us. Taz 1 Link to comment Share on other sites More sharing options...
samid737 Posted September 11, 2017 Share Posted September 11, 2017 Here is an example you can further build upon: You can for example make a fireBall object/class and when spawning them, set the "trigger" value. The trigger number makes the fireball grow and shrink. Then after a while you can set the trigger value back to 0. The position of the fireball can be set just like in update(), but instead pass the coordinates of the enemy. If you prefer just the fireball static: you can adjust the intensity of the fireball by adjusting this inside the shader: "float color = 3.0 - (3.*length(2.*p));", //this sets the intensity of the fireball The "blaze" can be adjusted in line 81: "color += (1.5 / power) * snoise(coord + vec3(0.,-time*.05, time*.01), power*16.);", //original fireball //example: "color += (0.1 / power) * snoise(coord + vec3(0.,-time*.05, time*.01), power*16.);", //this will make it look like the sun If you want a slightly different fireball, experiment with some the numbers inside, you can probably tweak it to some awesome effect. Taz 1 Link to comment Share on other sites More sharing options...
slaanevil Posted September 12, 2017 Author Share Posted September 12, 2017 First, thanks for all, your code it's useful for us. So, we have another question but, this time will be very easy. Is possible to change the background color of the filter? Because at now the look and fell is not good for us. We want to remove the "black" background or set to transparent. We are thankful Link to comment Share on other sites More sharing options...
samid737 Posted September 12, 2017 Share Posted September 12, 2017 you can set the blendMode of the fireball sprite: static: Link to comment Share on other sites More sharing options...
Recommended Posts