#Top-Down Melee attacks

5 messages · Page 1 of 1 (latest)

mystic kayak
severe jolt
mystic kayak
severe jolt
hidden storm
#
function cardinal_dir(_dir)
{
    var _d = round(_dir/90);
    if _d == 4 _d = 0;
    return _d;
}```

I'm making a top down game and I use this function all the time. For example, to decide which walk sprite to display based on an analog stick's 360 degree position. Choosing one of four directional attack animations would be another use case.

I haven't seen your game, but if you're using mouse to aim though kinda like binding of issac, it would be more precise if you used a single "forward" attack animation and actually rotated the character to aim directly at the mouse. That may be a better or worse fit but you won't know for sure unless you try both.