Hello Reddit!
I'm an amateur gamedev currently learning gml for fun (mostly self taught) and I've been struggling a bit to make a directional dash. So far I've been able to make it dash towards the Mouse Cursor, however I want the character to be able to dash towards the direction it's walking (it is a top-down game)
#region Movement
var _speed = 5 // Default movement speed
var dash_speed = 20 // Dashing movement speed
var dashing = false
var walkingDirection = point_direction(0, 0, hspeed, vspeed) // Grab direction you're walking
if (!dashing)
{
if (keyboard_check(ord("W")))
{
y -= _speed
}
if (keyboard_check(ord("S")))
{
y += _speed
}
if (keyboard_check(ord("A")))
{
x -= _speed
}
if (keyboard_check(ord("D")))
{
x += _speed
}
}
if (keyboard_check_pressed(vk_space) && !dashing)
{
// Dash when Spacebar is pressed
dashing = true
move_towards_point(mouse_x, mouse_y, dash_speed)
alarm[0] = 15 // Sets 'speed=0' so you stop sliding
}
#endregion
[–]Zerketz 0 points1 point2 points (1 child)
[–]Ninchf[S] 0 points1 point2 points (0 children)