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

Expanding circle without extending x and y

R

Roberto

Guest
OK so I'm trying to do a sort of "wave" effect of an expanding circle but for the life of me I can't seem to figure out how to do it without using image_xscale and image_yscale. The stretching I get with this method is fairly undesirable.

If anyone knows a better way It would be greatly appreciated if you could share it.
The closest visual example I could give for what I'm aiming for would be the various "wave" attacks of the recently released Furi, those are pretty close to what I'm aiming for.

Thank you: Rob DC
 
R

Robert

Guest
I mean stretching a sprite always has the same results, there is only one way, that I know of, to stretch a sprite.

If the problem is that stretching something larger than its native size will cause it to look blurry since it has to interpret all the new pixels, so basically never stretch something larger than its native size (unless you know what your doing).

So with that in mind I would make the circle sprite at its largest size and then SCALE IT DOWN for its regular state, so this way when you stretch it back up you are just stretching it to its normal size.

If you don't need a sprite though you could maybe get away with just drawing basic shapes.
 
T

TDSrock

Guest
Why are you not using draw_circle?

There you could simply modify the the radius of the circle in the functions parameter.
 
R

Roberto

Guest
I thought about it but I need it to be able to check for collision. I haven't been able to find any explanations on how to do that. If you know a way please say.
 

jo-thijs

Member
You can use collision_circle to check for collisions with circles.
You won't be able to use collision events with that though,
so you'll have to check for collisions yourself in the (end) step event.
 

jo-thijs

Member
That won't remain a nice circle though when scaling, not even if you choose for an ellipse collision mask.
 
R

Roberto

Guest
Bit late to this. Took a brief vacation. Is there any way to give the circle a thickness?
 

jo-thijs

Member
I'd like to give a code alternative without using extensions (though using the extension isn't the worst idea, as it might be more optimized and easy to use, though it might lack adaptability and compatibility):
Code:
draw_set_color(...);
draw_set_alpha(...);

var X = // x coordinate of center of circle
var Y = // y coordinate of centre of circle
var r1 = // lower radius bound
var r2 = // upper radius bound
var precision = 24;
draw_primitive_begin(pr_trianglefan);
for(var d = 0; d < 360; d += precision) {
    draw_vertex(X + lengthdir_x(r1, d), Y + lengthdir_y(r1, d));
    draw_vertex(X + lengthdir_x(r2, d), Y + lengthdir_y(r2, d));
}
draw_vertex(X + r1, Y);
draw_vertex(X + r2, Y);
draw_primitive_end();
I haven't tested the code yet, but this should do.
 
Top