B
BOON
Guest
Hello, I'm making something like this example
(I want to achieve something like this death animation (the colors specifically)
What I want to do is basically offset the color channels of a Sprite or the entire image after its been destroyed by the player
I found a shader that I can use in GameMaker that can make such an effect
https://marketplace.yoyogames.com/assets/3046/chromatic-aberration-shader
but I have little experience with shaders and now that I've imported the shader I'm unsure how I can apply it only at the instance where I want it.
_______________________________________________________________________________________
Here is the object and events and scripts that the shader came with, essentially it did exactly what is presented in its trailer
You click SPACE then it creates an image which you can then control how much of the effect you want to apply with the left and right keys.
Here is the code that came with an object that interacts with the shader.
///This is a create event
dis_u = shader_get_uniform(sh_aberration, 'u_Distance');
dis = 1;
shader = 1;
draw_set_font(f_std);
str = 'Press space to turn on/off the shader.#';
str += 'Press Left or Right to change the distance.';
///A step event
dis += (keyboard_check(vk_right)-keyboard_check(vk_left))/10;
if (keyboard_check_released(vk_space)) {
shader = !shader;
}
____________________________________________________________________________
///A normal draw event
if (shader = 1) {
shader_set(sh_aberration);
shader_set_uniform_f(dis_u, dis);
}
draw_background(b_back, x, y);
shader_reset();
draw_text(16, 16, str);
How can I control this effect so that it applies when you destroy an enemy?
(I want to achieve something like this death animation (the colors specifically)
What I want to do is basically offset the color channels of a Sprite or the entire image after its been destroyed by the player
I found a shader that I can use in GameMaker that can make such an effect
https://marketplace.yoyogames.com/assets/3046/chromatic-aberration-shader
but I have little experience with shaders and now that I've imported the shader I'm unsure how I can apply it only at the instance where I want it.
_______________________________________________________________________________________
Here is the object and events and scripts that the shader came with, essentially it did exactly what is presented in its trailer
You click SPACE then it creates an image which you can then control how much of the effect you want to apply with the left and right keys.
Here is the code that came with an object that interacts with the shader.
///This is a create event
dis_u = shader_get_uniform(sh_aberration, 'u_Distance');
dis = 1;
shader = 1;
draw_set_font(f_std);
str = 'Press space to turn on/off the shader.#';
str += 'Press Left or Right to change the distance.';
///A step event
dis += (keyboard_check(vk_right)-keyboard_check(vk_left))/10;
if (keyboard_check_released(vk_space)) {
shader = !shader;
}
____________________________________________________________________________
///A normal draw event
if (shader = 1) {
shader_set(sh_aberration);
shader_set_uniform_f(dis_u, dis);
}
draw_background(b_back, x, y);
shader_reset();
draw_text(16, 16, str);
How can I control this effect so that it applies when you destroy an enemy?