G
GoldenLeaf
Guest
So real quick, this is my first post on here and my first attempt at a project, so I apologize in advance if this has been covered before, if this is in the wrong section, if there is some formatting or other nuances I get incorrect, or if I just flat out sound dumb, lol. Noob trying to learn
Anyways, what I am trying to do is have an object be able to be placed by the player, and once placed it has a circle around it (at a set radius) with all the colors inverted within the circle (and only within the circle) until the object expires.
So far, I've made the object (or three object rather, 1) the object on the ground for the player to pick up, 2) the object that hangs out on the player sprite to indicate they have the item, and 3) the object which is created when the player uses the item) and then is destroyed once it's internal timer runs out, So all good there.
Then I also downloaded a shader off of the yoyo game store to be used to invert the color, I will be referring to this shader as "shInvert"
VVV see code below VVV
However, this is where my issue comes up. I can't find a way to draw the circle and only have the shader apply within the circle. Whenever I do "shader_set(shInvert);" it inverts the color to the entire screen, and not just within the area of the circle. I've tried messing around with draw_circle and draw_circle_color with no luck as I'm not sure how to apply a shader to either of those, and draw_circle_color only lets me input a single color argument (well 2, the inside and the outline colors). I've been looking around on the forums and YouTube for the past couple of days with no luck so I figured I'd make an account and make a post (as I'm sure I will have a million more issues to come, lol).
Anyways, any helps would be greatly appreciated! And please, let me know if I should include any code or anything like that
Anyways, what I am trying to do is have an object be able to be placed by the player, and once placed it has a circle around it (at a set radius) with all the colors inverted within the circle (and only within the circle) until the object expires.
So far, I've made the object (or three object rather, 1) the object on the ground for the player to pick up, 2) the object that hangs out on the player sprite to indicate they have the item, and 3) the object which is created when the player uses the item) and then is destroyed once it's internal timer runs out, So all good there.
Then I also downloaded a shader off of the yoyo game store to be used to invert the color, I will be referring to this shader as "shInvert"
VVV see code below VVV
GML:
attribute vec3 in_Position;
attribute vec4 in_Colour;
attribute vec2 in_TextureCoord;
varying vec2 v_texcoord;
void main()
{
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * vec4(in_Position, 1.0);
v_texcoord = in_TextureCoord;
}
Code:
varying vec2 v_texcoord;
uniform float time;
uniform vec2 mouse_pos;
uniform vec2 resolution;
uniform float strength;
void main()
{
vec4 colour = texture2D(gm_BaseTexture, v_texcoord);
gl_FragColor.rgb = 1.0 - colour.rgb;
gl_FragColor.a = colour.a;
}
Anyways, any helps would be greatly appreciated! And please, let me know if I should include any code or anything like that
Last edited by a moderator: