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

Game Mechanics Show where teleport, and the direction of my shoot

Sawyer

Member
Hello everyone,

In my game i can teleport my player and shoot.
With my mouse i left click to shoot in the correct direction.
With my mouse i right click where i want to teleport.
My teleport have a maximum range.

Actually i have 2 crosshairs.
the crosshair for teleport stay in the teleport range and show you where you will teleport
the crosshair for shoot shavent any range and show you where you will shoot

I want to improve the way i show where:
- you will shoot if left click
- you will teleport if right click

For me it's ugly or annoying to have this crosshair teleport all the time near of my player.
 

Sawyer

Member
I also tried this lines but it's so ugly

To show the lines
GML:
    draw_set_colour(c_red);
    draw_line(x, y, x + target_xx*100, y + target_yy*100);
    draw_set_colour(c_lime);
    draw_line(x, y, x + target_xx, y + target_yy);
In step event
GML:
range = 200;
mouse_direction = point_direction(x, y, mouse_x, mouse_y);
mouse_distance = clamp(0, point_distance(x, y, mouse_x, mouse_y), range);//can't go out of the range
target_xx = lengthdir_x(mouse_distance, mouse_direction);
target_yy = lengthdir_y(mouse_distance, mouse_direction);
 
You could try using one set of crosshairs that changes red when you're out of teleportation range. At this point, when you try to teleport, the player could either a) not teleport, because the crosshair is out of range, or b) teleport to the place within range that's closest to the crosshairs. You could also try creating a silhouette of the player that appears when you right click, which can be repositioned like a crosshair until you RELEASE the mouse button to actually teleport.
 
Top