• 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 Dashing towards the mouse

W

Waffliple

Guest
Hello! I've been searching quite a bit for a situation like this but I still can't seem to figure this out.
What I've trying to accomplish is a short range dash towards the mouse in a 2D platformer. I've been able to pull off a short blink with a maximum range of 300 towards the mouse which was great but I really want to see it be a smooth movement rather than a quick teleport. The closest I've gotten has been with move_point_direction but using it with keyboard_check_pressed would only move me one instance of the speed value in the move_point_direction.

Code:
if (key_dash) && dash = 0 {
    move_towards_point(mouse_x,mouse_y,20)
     dash = 1;
     alarm[0] = room_speed
    }
    else speed =0;
this is what i have regarding the dash at the moment, with key_dash being keyboard_check_pressed shift. am i going in the complete wrong direction or am i missing something really minor?
 
J

JFitch

Guest
Put speed=0 in the alarm. You want it to stop moving when the alarm is triggered. Right now, it stops moving whenever the statement "(key_dash) && dash = 0" is false, which is immediately.
 
W

Waffliple

Guest
Wow... I'm upset I didn't think of that haha I had gotten into the mindset of seeing the alarm as just the cooldown for the dash that i stopped thinking about being able to use it for something else. Thanks, bud!
 
M

mickael ordine

Guest
Hello! I've been searching quite a bit for a situation like this but I still can't seem to figure this out.
What I've trying to accomplish is a short range dash towards the mouse in a 2D platformer. I've been able to pull off a short blink with a maximum range of 300 towards the mouse which was great but I really want to see it be a smooth movement rather than a quick teleport. The closest I've gotten has been with move_point_direction but using it with keyboard_check_pressed would only move me one instance of the speed value in the move_point_direction.

Code:
if (key_dash) && dash = 0 {
    move_towards_point(mouse_x,mouse_y,20)
     dash = 1;
     alarm[0] = room_speed
    }
    else speed =0;
this is what i have regarding the dash at the moment, with key_dash being keyboard_check_pressed shift. am i going in the complete wrong direction or am i missing something really minor?
how can I repeat the dash when i touch the floor?
 
Last edited by a moderator:
Top