#YouTube Simple top view movement?

7 messages · Page 1 of 1 (latest)

elfin vortex
#

Wondering if there are any videos for top-view movement controls, I tried other engines this one seemed way simpler and more visual and the other official communities of other engines poked fun when I asked questions. I just want a basic rpg four-movement controller tutorial I can swap relatively easily for Android and Windows platforms respectively, with Idle animations in each direction, and movement in each direction. I kind of made one but it sucks really bad.

#
rightKey = keyboard_check(vk_right);
leftKey = keyboard_check(vk_left);
upKey = keyboard_check(vk_up);
downKey = keyboard_check(vk_down);

// Getting the x and y speeds
xspd = (rightKey - leftKey) * moveSpd;
yspd = (downKey - upKey) * moveSpd;

// Change sprite based on movement
if (xspd != 0 || yspd != 0)
{
    // Player is moving
    if (abs(xspd) > abs(yspd))
    {
        // Horizontal movement
        sprite_index = DaisyWalkRightGif;
        image_xscale = sign(xspd); // Flip sprite based on movement direction
    }
    else
    {
        // Vertical movement
        if (yspd > 0)
            sprite_index = DaisyWalkDownGif;
        else if (yspd < 0)
            sprite_index = DaisyWalkUpGif;
    }
}
else
{
    // Player is idle
    if (xspd == 0 && yspd == 0)
    {
        if (sprite_index == DaisyWalkUpGif)
            sprite_index = DaisyIdleUp;
        else if (sprite_index == DaisyWalkDownGif)
            sprite_index = DaisyIdleDown;
        else if (sprite_index == DaisyWalkRightGif && xspd < 0)
            sprite_index = DaisyIdleLeft;
        else if (sprite_index == DaisyWalkRightGif && xspd > 0)
            sprite_index = DaisyIdleRight;
    }
}
#

this was mine it was trash

#

just want some tutorial links or help I cant find any

elfin vortex
#

edit: painstakingly took hours and hours and invented my own way, fixed

bleak dragon
#

Did the xspd = rightkey - leftkey thing work?

#

It feels like it should