A few issues on attack animation and enemy behaviour

  • Oh i can no longer open the file as it's already saved in the latest r165 build....sorry

  • 1) Create a new imagepoint on your sprite. Call it "punch"

    Create a new event that pins the "helper" or punch collision box to that imagepoint of your sprite.

    Detect collisions for punching the enemy from the helper you created and not from your player sprite.

    If Punch Helper collides with enemy - destroy enemy

    2) Use if key pressed. Not if key is down. If key K is pressed set animation to "player punching"

    Create another event If animation "player punching" finished set animation to "Player idle"

    3) Yes i had this issue as well. Create the helper object off the screen. Create an event that spawns a new helper and sets it position to the imagepoint as discussed earlier. On animation idle destroy helper

    4) Give enemies platform behavior. Disable the default platform movement. Create a new helper. E_Jump or whatever you wanna call it.

    Create an event if enemy collides with "E_Jump" helper then simulate platform pressing jump.

    Basically you will need to place that helper at every possible place you want them to jump. Near edges of platforms.

    I hope this helps. If not im planning on doing a tutorial soon on how i did all my platform movements and enemies.

  • Ldk thanks for these suggestions, let me go try them out and i will post an update here

  • Ldk i have tried your suggestions. They somehow work but not really as intended as they were supposed to. I wonder if Construct 2 is glitching the game or i did it wrongly. I have attach screenshots below to give a better understand of the issues.

    1) I had already created an imagepoint and a collision box for the hit detection and i have also pinned the collision box onto the fist of my character. The reason why i have 2 imagepoints so that they will be able to display the collision box when i'm facing mirrored and non-mirrored way while punching. But i think i may have missed out something here and i ended up with this instead.

    As you can see, the non-mirrored side's collision box is displayed correctly just nice over the fist

    but for the mirrored side, i get this instead

    Below here is my code

    So i need to have the collision box be displayed correctly on the mirrored side.

    2)I can't seem to find the event where it says when "player punching" animation is finished, set animation to "player idle". What i did was instead this. But i still can hold down the punch button even thou it's already set to "On Pressed"

    3)I have already did that and the collision box is outside of the screen and i tried to add in the "destory" box after animation ends but i get the issue of my player punches once, the box comes up then disappears after going back to idle animation and then it doesn't appear back even i pressed punch again. It seemed to be destroyed forever.

    this is the code

    4) I managed to solve this by adding in helpers and it works.

    Hope others can learn from this also!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • bump for others to have a look

  • Yeah I got to that same point when i was working with your project and i couldn't figure it out

    I do not have any issues with it on the game I am working on but for some reason i can't get it to mirror right non yours lol

  • Yeah I got to that same point when i was working with your project and i couldn't figure it out

    I do not have any issues with it on the game I am working on but for some reason i can't get it to mirror right non yours lol

    ZeroBelow Yeah. It's very weird right? I mean, if you have already set the collision box to the imagepoint and since it's already set to mirrored and non-mirrored when you push the left and right key. The collision box should position the same.

    Is this a bug? Maybe the developers of Construct 2 can take a look at this?

  • Bump for more pros to look at it

  • Hi.

    You do not need seperate imagepoints for mirrored or non mirrored.

    It should work with just one imagepoint.

    This is what i did. Keep in mind it looks a bit more complex than it should be, as its part of a combo attack.

    Quick explanation of the steps.

    1: If attack is pressed set the instance variable of the character.

    2: If the variable is set, then only can it play the attack animation

    3: If the attack animation is playing, then set the helper to the imagepoint of your character

    4: If the animation is finished playing set the helper to position 0,0. (i also found if you destroy the helper its gone forever.) Then set animation to idle.

    The bug you speak of of the imagepoint i think is related to the way you set up your events as i experience similar issues.

    Try the above method using only 1 imagepoint. Only set the imagepoint while the animation is playing like i did.

    Also make sure your sprite is scaled weird as this can cause issues when mirroring it.

    Hope this helps

  • 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.

    why are you using pathfiding instead of platform behaviour??

  • Ldk thanks for this, i will take a closer look when i'm free and post an update here again.

    Lunatrap it was suggested by another user here as i want the enemy to chase the player, the enemy has both platform and pathfinding behaviour in them. Do you have a better way to just use platform behaviour and have the enemy chase the player too?

  • Ldk thanks for this, i will take a closer look when i'm free and post an update here again.

    Lunatrap it was suggested by another user here as i want the enemy to chase the player, the enemy has both platform and pathfinding behaviour in them. Do you have a better way to just use platform behaviour and have the enemy chase the player too?

    pathfinding is not neccesary, it will just take CPU power and it reacts very slowly...

    here you go...very basic, i hope you can add more... like jump and more...

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