A few issues on attack animation and enemy behaviour

0 favourites
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hi guys,

    Been reading the forums and looking for answers but to no solution to my problems.

    I'm trying to create a platform fighting game and i have a few issues at hand

    1) I have added in a few animations on the player sprite and one of the is the punching animation. I understand that in order for the game to know that when the player sprite's fist hits the enemy then a collusion will have to be on the fist. I tried adding a collusion box to the fist but it seemed to be displaying correct on the mirrored side of the sprite but not on the non-mirrored side as i'm guessing the imagepoint causing the issue.

    2) How do i after pressing the punch button (k), the animation will end? Right now when i press and hold the button K, the punch animation stays there instead of going back to the idle animation.

    3) Also, after i press the punch button (k), the collusion box stays at where the last animation is played. How do i also after the punch animation ends the collusion box disappears too?

    4) I tried to have the enemies chase the player around the game but there's 2 things i can't get my head around which is 1) Make the AI able to jump on the platforms and chase the player 2) Why are my enemies all turning in all different directions and not walking on the ground as they are supposed to?

    I have attached my capx file for the pros here to take a look.

  • Bump! Anyone can help? Thanks thanks thanks!

  • First off I'll tackle the easier problem first. You enemies rotate because on the pathfinding behaviors you need to set rotate to no. I'll look into the other issue if I have the time.

  • Instead of using the "key is down" use "Key is pressed" It should give you the action you are looking for. Also try using the "player"- "animations" under the add actions. You could set it up where the hit box will only be set up when the animation is playing.

    As for the AI i do not have to much experience with that right now, I am learning more for it.

  • Hi!

    Thanks for the help so far! I have switched off rotation for the enemy but they seemed to bouncing on the floor thou.

    I did try both "Key is down" and "key is pressed", i still get the same issue which i can hold down the button and the animation stays there.

  • For collisions, you can do what I do and add another invisible box that floats out in front of the character AND another one for the enemies so when they overlap and you hit attack, it knows to do the attacking routine. This might help with the other issue, gets rid of the need for collision boxes. Sure it's more stuff loaded, but platformers are picky by nature.

  • which means the animation itself you add in another invisible box?

  • you need to make it where when the animation of the punch ends it goes back to idle

    also idk how you did it but your punch animation is glitched and it seems to be over ridding the default animation

    I fixed it by duplicating punch and renaming it to punch1.

  • Did you solve your issue?

    I am also busy with a platformer. With fighting combos.

    The following works properly with animations cycling as they should.

    Attack + press nothing else = Attack then go to idle.

    Attack + Attack = Attack followed by kick animation.

    Attack + Attack + Attack = Attack followed by Kick followed by Slice Animation

    Jump + in air + kick = Flying kick

    Jump rapidly pressing attack = Low Flying kick

    All of these work well with enemies detecting collisions and dying when struck.

    I also made enemies get damaged if you kick an enemy into another enemy.

    Point is, if you did not fix your issue i will have a look, but sounds like you fixed it.

  • Ldk Sorry i can't seem to solve this issue. Neither for the AI part. Been messing around the codes but seemed to be stuck.

    Looks like it's easier to make a shooter game than a melee fighting game thou.

  • I mean how you have the box for the player, then the player's sprite? Add another box that's attached to an image point where it's always in front of the player. This makes it SO much easier for detecting direction.

    As for animations, you need to make sure the event "animation idle is NOT playing" etc to ensure your animations are in tact. Idle should be the lower most point of animations. Imagine the "idle" animation as if it were a rubber band. any new animation playing is like popping that rubber band, but it HAS to be back in place when it's over. Computers don't know to put things the way they were, just the last way you told them. So if you tell it "it should be this way" then you have it do something else, make sure "that way" isn't active, and when the new way is done, ensure the old way is back in place.

    It's so hard to explain, which is why I'm not a teacher, but it works in my mind to think of animation and game states as rubber bands that get popped here and there, but after the popping is done it goes back to a general state (ie: idle, health restoration, enemies walking, etc). The state the game is in with ZERO input from the user is the default state you want, and any other state must be told "idle state is not playing" (and idle state should have "walking is not playing, attacking is not playing, jumping is not playing" etc.

    I think comprehending the theory of game design is far more important than the code (with Construct 2 at least) but at the same time there are good practices no matter how one codes it. Just remember the computer isn't smart, you are.

  • Hi.

    I cannot open the CAPX as im still on an old version.

    Will download the newer version and have a look.

    In the meantime.

    The invisible box or "player helper" is the movement. The sprites on top of that are animations.

    You go this route because your hitbox or collision detection on different frames change a lot on animated objects. So it just simplifies things and makes collision detection simpler.

    TIP: do not use a square player helper. Cut the bottom corners. Prevents player getting stuck on small ridges.

    For enemies. Use Turret behavior and platform behavior. No rotate for turret. Set events to simulate platform pressing direction of player.

    Will make more sense later. Busy downloading newer version to have a look at your file

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ldk My animations are just sprites....the player box is the one set with the platform behaviour.

  • Do you perhaps have another CAPX. im not too keen on using beta builds

  • Ldk Let me go download install the latest non beta build

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