xyz So I tried this:
func get_dir():
var dir = velocity
var angle = posmod(rad_to_deg(dir.angle()), 360)
var sector = wrapi(snapped(angle, 45) / 45, 0, 8)
return ["E", "SE", "S", "SW", "W", "NW", "N", "NE"] [sector]
and this:
dir_last = get_dir()
and it works for input and seems to work for bouncing off of things! But if I could fix one last issue, it should work how I want it.
Unfortunately I can no longer say
velocity = dir_last * speed
when shooting my character in the direction facing using the "BLAST" state.
If you would be so, SO generous to help me with with an alternative so that I can still shoot the character in the direction they are facing, it would really help me out.
Thank you!