Trigger Throw animation while running.

0 favourites
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • How do you set up events to trigger the player's throw animation while running and then return to the default running when the button is not pressed?

    I've tried to use a variable "Move" and add 1 if the key is down to run. Then as a sub event if "Move" = or greater to 1 and key is PRESSED to trigger throw animation. When Throw animation is finished or key is RELEASED, set MOVE to 0 and continue to play run animation if key for direction is down.

    I've tried a few other variations with conditions or a separate event, but nothing is working. I can get the player to trigger the throw animation and continues to move, but it is stuck in the throw frame/animation.

    Thanks

  • If throw key is down -> play throw anim

    if run key is down, and throw key is not down - > play run anim

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • He only does the throw animation if I stop. Not sure why it isn't working.

  • Get rid of the first event...the third one is now the run event.

  • Thanks! It did work, but the next problem is the angles. Using this sequence of events, how do I get the angle of motion animation to trigger while moving? (The 45, 135, 225, and the 315 angles) The direction for those angles work as he moves in those directions, just the running animation wont fire up.

  • You can use conditions based on the player's angle I guess. See what property changes. Or another option is something with key + key is down

  • I tried the key + key down to see if it would trigger the angle animation, but it didn't. I also tried variations of the following. Not sure why the NW, NE, SW, SE angles don't play their angled animation, even though with keys down together (A,W - A,S, etc.) move the player in the respected direction.

    All the tutorials on the Construct site, Google Searches, and Youtube doesn't cover it.

  • There won't be much info on this because it's not common to have 8 animations even if the character moves diagonally. Also it's possible the object's angle doesn't change so you should check this, 8 direction movement angle and the player object's angle are two different things.

    Also the screenshot you shared, that can still conflict with the event for A is down or W is down, they can both be true. You would probably have to add angle conditions to the basic 4 direction movement events as well. For example if you press A it tries to play 180 and this is true even if you press A and W at the same time so it tries to play 2 animations, 180 and the one from the screenshot.

  • Well, I managed to make it work minus the 315 degrees going Northeast.

    I can run in that direction triggering the animation. I can stop and throw a projectile in that direction with animation triggering, but I can't run and trigger the 315 throw animation. All the other directions work along with the angle of the "bullet" motion. When I debug, the animations show they all change except from 315 (name of direction of animation) to 315THROW (name of one frame throwing animation for that direction). It is a stumper. Not sure if it has something to do with Event 1.

  • That is strange I guess if the running works and the idle throwing works which means the correct animation is playing. Use browser logging to debug the angle values and see if they are expected.

  • I was wrong. If I'm standing still the animation won't trigger back from throw animation to the regular animation. I can only throw when I'm moving and the animation will trigger back and forth (except for the 315 angle).

    There has to be some way to make it all work. I can't imagine construct not being able to do the 8 directional movement and trigger a "throwing" animation and can switch back and forth along with idle throwing animation. I'll keep trying and then I'll post it here for others to use.

    Thanks.

  • I was wrong. If I'm standing still the animation won't trigger back from throw animation to the regular animation. I can only throw when I'm moving and the animation will trigger back and forth (except for the 315 angle).

    There has to be some way to make it all work. I can't imagine construct not being able to do the 8 directional movement and trigger a "throwing" animation and can switch back and forth along with idle throwing animation. I'll keep trying and then I'll post it here for others to use.

    Thanks.

    First problem you describe is because from what I can see you have no logic for idle. If you throw it sets to throw, but then you have to actually move to set any other animations, or press the throw button. Maybe remove the 8 direction is moving condition from the top? If it's the same animation. If you have a separate 8 idle animations then you need more logic.

    For the 315 angle try browser logging there's a chance it's using a value like -45 for angle which won't match with anything.

  • If I send you the capx file, do you think you would have time in the near future to try and give it a go to make it work?

  • I can take a look sure link it. If it's a large project trim it down where possible as I didn't buy C3 recently.

  • dropbox.com/s/7unaxe5h71qt6t1/8direction.c3p

    You can delete events/behaviors/variables as you see fit.

    Just trying to make the player throw in all 8 directions while returning to run animation when not throwing as with throwing when standing still. Something is blocking it from doing so.

    Thanks

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