0 Favourites

Platform Attack While Crouching

This forum is currently in read-only mode.
  • I'm making a Zelda II style game, but can't get Link to attack while crouching. I have an animation called "attacking" for attacking while standing up, and another called "crouchAttack" for attacking while crouching. Link has a private variable called "crouching" where 0=standing and 1=crouching, it turns to 1 when Z is held down.

    Download

  • Can't take a look at it because it looks like the download is private.

    Krush.

  • Sorry about that, this link should work.

    https://docs.google.com/leaf?id=0B9d5pq ... 2&hl=en_US

  • Hmm.

    Well, looking at your code, I can see no reason why it doesn't work.

    For example, place a text object on the layout and use "Always" to display both the crouchingVar and the current animation name of Link, and you'll see that the states are all as you'd expect when pressing the buttons, except for the crouchAttack animation, which doesn't show up at all.

    I think that it might be a quirk with Construct.

    To prove this, change the

    + link: Value 'crouchingVar' Equal to 1

    -> link: Set animation to "crouchAttack"

    to

    + link: Value 'crouchingVar' Equal to 1

    -> link: Set animation to "attacking"

    so that it's the same as when 'crouchingVar' equals 0, just to prove that the conditions work.

    It seems that the "crouchAttack" animation just won't play.

    Try deleting that animation, and then set it up again.

    Construct can be like this sometimes.

    Krush.

  • I deleted the animation and made it again but it didn't seem to do anything :/

  • I deleted the animation and made it again but it didn't seem to do anything :/

    Hi, i tried your cap, and the problem could be because you have 2 animations tied to the 'z' button.

    Why dont you just have the 'crouchattack' animation play everytime he crouches?

    Amended

    I actually meant the 'down arrow key'. The crouchattack animation does work for a split second, but having the down arrow key at the same time seems to over-ride it.

  • The reason it doesn't work is (edit: partly) because how you've ordered your events. I moved the event handling your animations above the one initiating the attack animations and the crouch attack starts. It's immediately changed back to the crouching animation though. I haven't looked through the animation event that much but it's pretty clear that it cancels out your crouch atttack animation.

  • > I deleted the animation and made it again but it didn't seem to do anything :/

    >

    Hi, i tried your cap, and the problem could be because you have 2 animations tied to the 'z' button.

    Why dont you just have the 'crouchattack' animation play everytime he crouches?

    Amended

    I actually meant the 'down arrow key'. The crouchattack animation does work for a split second, but having the down arrow key at the same time seems to over-ride it.

    I see what the problem is but I wanted link to be able to crouch to block things that are low, and be able to attack things that are low. The code should work considering I said the "crouching" animation should only play if the animation isn't currently "crouch attack". I think it's some kind of bug with construct.

  • Have you read the Platform School tutorial By deadeye ?

    It has a good section on animation event sorting.

    http://www.scirra.com/forum/viewtopic.php?f=8&t=2154

  • Have you read the Platform School tutorial By deadeye ?

    It has a good section on animation event sorting.

    http://www.scirra.com/forum/viewtopic.php?f=8&t=2154

    Yes I have, unfortunately I don't think it would help out to reread it in this case.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I edited you cap, it's working now.

    download

    edited

  • I edited you cap, it's working now.

    download

    The animation doesn't work on my p.c.?

    ----------------------------------------------------------------------------------------------

    Here's a working example i put together

    http://dl.dropbox.com/u/22173473/Z_solution.cap

    This is how i did it -

    Added a dummy with only 2 frames of animation, and a wait object.

    Set the dummy to invisilble at start.

    Then add these lines to the event sheet-

    <img src="http://dl.dropbox.com/u/22173473/zeldapic.png">

    Woops, forgot about the 180 angle for dummy animation, added this event to line 18

    + System: Always (every tick)

    -> link2: Set position to object link (image point 0)

    -> link2: Set angle to link.Angle

  • You guys are making this way too complicated

    Fix: http://dl.dropbox.com/u/17634050/Zelda%20II_fix.cap

    (Also fixes a bug where you can't attack in-air while holding down)

    Kinda had to re-do all of your events lol.

    Also, if I may.. Link is supposed to have 3 walking frames, less friction, and pulls his sword back before and after attacking. You're also using the wrong frames for jumping. Aaaand you might want to make a 'base' or 'collision mask' for Link or he will get hung on ledges and stuff. Ok I'm leaving now..

  • Yeah, I forgot to include conditions and two more actions, it's fixed now.

  • I was able to fix it by getting rid of the crouching variable and by saying when the down arrow key is down and z is pressed use the animation, it's more messy but at least it works.

    Here's the fix if you want to see:

    Download

    Also, if I may.. Link is supposed to have 3 walking frames, less friction, and pulls his sword back before and after attacking. You're also using the wrong frames for jumping. Aaaand you might want to make a 'base' or 'collision mask' for Link or he will get hung on ledges and stuff. Ok I'm leaving now..

    Thanks for the advice, I recently put in a collision sprite for link, but I didn't like the way link crouched before he jumped and landed in the original, also I made him a little faster and more maneuverable because it was just more fun to move around that way.

    Edit Edit:

    I downloaded your .cap and I couldn't figure out where you put the walking animation to play or link to stop moving when attacking or crouching.

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