Two-key - diagonal walk

0 favourites
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • hi. I still can?t solve one problem - im making kind of Zelda style game, but with 8direction behavior. Hero is independet on mouse. Animations of basic movements like walking down, wolking up, left, right, are ok, but i still can?t set animations for diagonal walk ( example of event: Down arrow is down + Left arrow is down) = set animation of run.

    But they are not moving. Loop is on, speed is 5. Do you know where the problem is??

    <img src="smileys/smiley5.gif" border="0" align="middle" />

  • I was wondering the same thing. I know a work-around to setting animations based upon the angle of the current player, but there is always a lag in animation change when changing directions, which is entirely unacceptable. The animation changes are instantaneous when they are mapped to keys, but when you try to do what you described it doesn't work.

  • I can link you to an explanation of the workaround if you want, or I will post here when I figure out how to do this without lag.

  • Try something like:

    Up key down

    -> Left key down: Set animation to up-left

    -> Else and Right key down: Set animation to up-right

    -> Else: Set animation to up

    Where the -> are sub-events. Then you do the same for all 4 directions.

  • siks: That does the same thing as my other potential solution; it triggers the first frame of the up-left animation, but the animation doesn't actually play.

  • Hm,I think I know what's going on.

    C2 is reading every frame that the Up and Left (for example) are being pressed, so it's setting the animation every frame!

    Try this:

    Up key is down

    -> Left key is pressed: Set animation to up-left

    -> Right key is pressed: Set animation to up-right

    -> Else: Set animation to up

    If it doesn't work, I may have another solution, but it's more complex... I hope this one works =P

  • " there is always a lag in animation change when changing directions, which is entirely unacceptable."

    I think I know what you mean now.

    https://dl.dropboxusercontent.com/u/78545260/SurvHorrPrototipo1.21/index.html

    If I'm right, I had the same problem in this demo.

  • That doesn't work either, and "Else" isn't valid when used in that event chain.

  • Else can't work on triggers, use is down conditions for the keys

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is the test level link:

    dl.dropboxusercontent.com/u/172450407/New%20project/index.html

    I have found 3 ways to make the Up-Left (W+A) animation to trigger, but it stays stuck in the first frame. I cannot, for the life of me, figure out how to get it to play from keyboard triggers.

    Here are the movement events as they sit now:

    <img src="http://i43.tinypic.com/33cyn3p.jpg" border="0" />

  • Maybe add a second condition to the "Letter is down" event, where it checks to see that the animation isn't already playing?

    (that way it won't restart the animation every tick?)

  • It does this even if "Every Tick" isn't the method used, but I will give it a shot.

    **Update: No dice.

    The animation doesn't move past the first frame no matter how I do it. *shrug*

  • Here is the test level link:

    https://dl.dropboxusercontent.com/u/172450407/New%20project/index.html

    I have found 3 ways to make the Up-Left (W+A) animation to trigger, but it stays stuck in the first frame. I cannot, for the life of me, figure out how to get it to play from keyboard triggers.

    Here are the movement events as they sit now:

    <img src="http://i43.tinypic.com/33cyn3p.jpg" border="0" />

    This doesn't work either. I have tried about 10 other ways as well, and they all end up with the first frame of the "UpLeft" animation frozen on the first frame. *shrug*

    OP: We will get this worked out eventually. lol

    <img src="http://i42.tinypic.com/143fcz5.jpg" border="0" />

  • All events fire every tick, except for trigger events.

    You don't really need "Every tick" event.

    That is what is happening, it actually says in your image "(play from beginning)" Which fires 30 to 60 times a second. Your animation restarts every tick.

  • I think I'm going to redo it all from the ground up using the Diablo example, but having key controls instead of point-and-click mouse controls. I don't know if it will work or not, and it will take awhile, so I will have to wait until I get off work tonight to try. I'll post the results.

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