4 Way Movement Animations With Mouse Input

0 favourites
  • 6 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hello, I'm happy to finally be part of the Construct Community. I've been working on an auto-shooter the last month with placeholder graphics and purchased a subscription today.

    I was thinking I would finally have enough events to do 4 or 8 way character walk animations. However, every forum post and youtube tutorial seems to be based on WASD movement and not following the mouse cursor like I have. How can you detect if the character is moving left/right etc without a button press?

    I can't even get the idle animation to work with or without using ticks, waits, checking pathing, arrived, or any other if statement I could find.

    The attached file is to show how my system works before extra animations.

    pixeldrain.com/u/1pKhPLed

    Thank you everyone for your help! I will have loads of other questions I can't find answers to if you are willing to lead the way and make my dreams come true!

    Tagged:

  • Hi, you have a cool style of graphics, I love it!

    Let me tell you about your screenshot first.

    If an event doesn't have a green arrow, it is already repeating constantly and you don't need to add "every tick" to it.

    And wait for "0,1" you added in vain this event will run about 60 times per second and constantly it will try to wait.

    Now for my suggestion. I believe that the change of animation of movement can be carried out not so often to save resources.

    Variable "AnglHero" I added that in the debugger it was convenient to see the angle of rotation. You can check the angle without it.

    pixeldrain.com/u/ZGSEhRDx

  • Hi, you have a cool style of graphics, I love it!

    Let me tell you about your screenshot first.

    If an event doesn't have a green arrow, it is already repeating constantly and you don't need to add "every tick" to it.

    And wait for "0,1" you added in vain this event will run about 60 times per second and constantly it will try to wait.

    Now for my suggestion. I believe that the change of animation of movement can be carried out not so often to save resources.

    Variable "AnglHero" I added that in the debugger it was convenient to see the angle of rotation. You can check the angle without it.

    https://pixeldrain.com/u/ZGSEhRDx

    Funny that you like the style of graphics because it is entirely placeholder and minor adjustments just to have something up and running.

    You are right that the wait and every tick are overkill but I was not sure how else to make it work because this attached image is exactly how I started and it reacts nearly the same way. It does not work starting from the current frame, or checking pathing, movespeed, having AND statement making sure the animation isn't already running,and anything else I try.(I also made sure those animations had an animation speed)

    Regarding the hero angle I am using your code example and will let you know how that goes once I can fix the idle animation issue. Thank you so much for reaching out!

  • Sure wish Construct Forums would let me edit my posts... This is the second time I have to delete a message. Here is the new world I'm trying to build the new movement on to make sure that it isn't interfering with anything else.

    pixeldrain.com/u/ajdWvmQB

    Here is a screenshot of my version of your suggested code which I cannot get to function (neither idle or mirroring is working). Thank you so much for being patient and working me through this!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Update!!! The Construct Discord was incredibly helpful and walked me through this one.

    The reason the angle wasn't working for me was that player itself isn't changing angles, so I needed to check for moveto.movingangle. Like this example:

    The reason idle wasn't working is because even though the character sprite stops moving, the program thought you were still trying to follow the mouse when the mouse overlaps with the character. This was fixed with an and statement in my move command:

    Basically it is making sure your mouse is not overlapping the player sprite which is 32x32 pixels.

  • Sure wish Construct Forums would let me edit my posts... This is the second time I have to delete a message. Here is the new world I'm trying to build the new movement on to make sure that it isn't interfering with anything else.

    https://pixeldrain.com/u/ajdWvmQB

    Here is a screenshot of my version of your suggested code which I cannot get to function (neither idle or mirroring is working). Thank you so much for being patient and working me through this!

    Can't you see that you've broken the hierarchy and you've got everything checking 60 times a second again.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)