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

Legacy GM [SOLVED] Trying to create an aiming reticle like that of Crimsonland

S

Sanctifier

Guest
Hi Everyone.

I'm working on a top down shooter that's inspired by Crimsonland. Currently I have a system where every time the weapon is fired recoil increases. For every unit of recoil, the deviation in the player's accuracy cone is widened by a single degree.

This system is currently working as intended. However, I'm wondering how I might go about representing the currently state of accuracy with a circle that widens as recoil increases.
 

Attachments

JackTurbo

Member
Simpliest way would probably be to have the reticle with a series of sub images that widen the outer ring element. Then you could set the image_speed to zero and base the image_index off of the recoil value.

A more complex approach would be to use draw_circle at the reticle's x/y and set the radius to be based off the recoil value.
 

Sabnock

Member
i would make a sprite of the circle at it's max size and then use draw_sprite_ext( sprite, subimg, x, y, xscale, yscale, rot, colour, alpha ); in a draw event and use the xscale, yscale to set the size.
 
S

Sanctifier

Guest
I could make a circle based off the recoil value, but I would also need it to adjust based on the distance between the player and the crosshair in order for it to be accurate
 
S

Sanctifier

Guest
Thanks everyone for the replies. I managed to solve the issue. Here's what the code looks like.

Code:
var mouseDist = point_distance(x, y, mouse_x, mouse_y);
var xx1, yy1, xx2, xx2, centerOffset;

xx1 = x+lengthdir_x(mouseDist, angle-accuracyOffset);
yy1 = y+lengthdir_y(mouseDist, angle-accuracyOffset);
xx2 = x+lengthdir_x(mouseDist, angle+accuracyOffset);
yy2 = y+lengthdir_y(mouseDist, angle+accuracyOffset);

centerOffset = point_distance(mouse_x, mouse_y, xx1, yy1);

draw_set_alpha(1);
draw_set_colour(c_black);
draw_circle(mouse_x, mouse_y, centerOffset, true);
draw_set_colour(c_ltgray);
draw_set_alpha(0.1);
//draw_triangle(x, y, xx1, yy1, xx2, yy2, false);
draw_circle(mouse_x, mouse_y, centerOffset, false);

draw_set_alpha(1);
draw_set_colour(c_white);
I created a triangle (commented out now) as a reference point. its width is determined by the offset caused by recoil and the length is determined by the distance of the cursor from the player. Then I measured the distance from one point to the cursor. Note: You can choose either point here as the difference is the same. That distance determines the radius of the circle which gives me an accurate view of the deviation of the projectiles at any distance.
 
Top