Weird issue with my game...

1 favourites
  • 13 posts
From the Asset Store
20 high quality click sounds, ready to improve your game's UI instantly
  • I'm trying to make a multiplayer fighting game. I've successfully implemented movement, jumping, blocking, and dodging in the game.

    Now I've moved onto attacking and this is where the issue arises. Everything I have is set to booleans except for holding down the keys A and D for movement. For some reason after I try spamming attack, it locks up the attack and it's just constantly set at False. It also locks up the jump so my character won't leave the platform, and my blocking stops working.

    File:

    drive.google.com/file/d/1Jg64Uxpd1zes5tJFx6AzGxRnYANVcCE9/view

    TL;DR

    Attack => cannot spam, jumping and blocking stops working

    spent hours on this already

  • You are triggering setting the boolean to true whenever you press the K key. You have a condition that set's the Attack animation to start if the boolean is true meaning that it will keep starting every tick, and you are using on animation finished to reset the boolean to false, which is never triggered because there is constantly an attack animation playing.

    If you don't want to be able to spam the attack faster than the animation you need to add the condition to your K button event: Is attack animation playing (inverted).

    This will only fire the trigger if the attack animation is not already playing. Then you need to add a trigger once while true condition to the event where you set the attack animation to play.

    If you do want to be able to spam faster than the animation leave your trigger animation as it is. Add the trigger once condition to the next event, and then change the condition to reset the boolean to false from animation finished, to on key K released.

  • So this is what I did so far with what you said. I wasn't sure how to proceed onwards. I decided I don't want the attack to be spammable. I think I did everything but it's still locking the character down.

  • I've set a text to return the true and false of the attack and it seems like it's returning to false.

  • I don't know what you mean by locking it down. You haven't added the trigger once condition to the event that starts the attack animation yet. It could be other events in your game causing the issue. Can't look at your project because it requires a plugin I don't have.

  • I updated the project. Sorry I'm not really sure what you mean by the condition that starts the animation, I thought it was just starting the animation once the key is pressed.

    drive.google.com/file/d/1Jg64Uxpd1zes5tJFx6AzGxRnYANVcCE9/view

    By locking down I mean after the attack, my character stops being able to jump or block. And if I'm attacking while moving, it stops being able to jump altogether. :(

  • Get rid of the variables, do you need them? Add the animation to the key press event.

  • You could certainly do it without using the booleans but I figured you had a reason for it.

  • I had a look at your project. The reason it is getting stuck is because you have the "is on floor" condition required to begin the attack. Because you have not used a uniform collision polygon for your character they are sometimes not registering as being on the floor. I set the collision polygon to be the same for all animations.

    I also got rid of your unnecessary mirroring events for that part but there are others you can get rid of. When you use mirroring, animations are automatically mirrored. You do not need to use separate actions.

    Here is the fixed project: 1drv.ms/u/s!AkmrWgxeuxlKhIg1mNHho3_3UOKL4w

  • So I can't change the collision half way through an animation? Even if the bottom points remain exactly the same.

  • Thank you so much for fixing this for me. It's been frustrating me for a long long time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to use the collision polygon as a hitbox for your attacks, you are best to use a separate sprite with a uniform collision box for all your movement behaviours and pin the sprite you use for animations/hitbox to it.

  • ahhhhhhhhh i see. thank you for that tip!

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