Collision event not working

0 favourites
  • 11 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi all,

    The capx. file can be found in the following link

    https: //drive.google.com/folderview?id=0B_aNwhmNZ_jKM3MxRWZNSDl0LVE&usp=sharing

    (pls remove the space after "http:")

    I'm very new to Construct 2, and I really need help with the following issues:

    Event 26: It's supposed to prevent the HP from dropping below 0, but it doesn't seem to work. If pichu attacks after ekans' HP drops below zero, it will keep dropping.

    (I destroyed the animation sprite, and not the moving sprite (i.e. Ekans) because I want to retain the MaxHP variable. Otherwise, the HP displayed in text will be 0 / 0. Should I make the HP variables "global" instead?)

    Event 62: The events work fine when pichu attacks ekans, but ekans' attack move just pass right through pichu without causing any damage, or causing the sprite to flash

    Event 65: This doesn't work either

    Any help, tip, guidance will be very much appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your file is locked from access.

  • Oops so sorry about that. I've changed the setting!

  • Event 26 is broken because it's being overriden by the HUD code. : every tick set ekans current HP to ekans.maxhp - ekans.damage.

  • Event 62 is broken because you destroy ekansmove for some reason. Once disabled, this works fine, although bear in mind the collision is minor between the two so collision boxes must be tiny or something.

    Event 65 seems to be working as expected.

  • I managed to rectify Event 26 by following your advice, but am still struggling with the other 2.

    Event 62: I destroy ekansmove becos I don't want the move to keep moving even after hitting a character. However, after I disabled that action as per your guidance, the move still flies past pichu. I did check the size of the collision polygon, and it should be at least as large as the images themselves.

    Event 65: The move should be destroyed after flying for some distance without hitting any character. It doesn't.

  • Event 65 has an issue with calculating the distance travelled somewhere, requires some investigation. You could trigger that in a different way, maybe On EkansMove created, wait a certain number of seconds and destroy? It's definitely not based on waiting for the animation to finish, I sped it up and checked that. For some reason it likes to stay around.

  • Ah I've just spotted it actually lol. When you attack with Ekans, his CD is greater than 1, but at event 67 you've said that if CD > 1 > disable all the attack logic. This actually disables the destroy bullet logic too. So it only starts calculating the distance once the CD drops.

    This is also the same reason for event 62 not working. Gotta be careful when disabling your grouped logic!

  • Really appreciate your insight ! I was under the impression that all the events under the "attacks" group would be resolved before moving on to "cooldown" group

    I figured it would be fine to transfer the "move"-related events (aside from the "press key" one) down to "cooldown" group. However, I'm just wondering if it's possible to inactivate a single event instead of an entire group?

    Another tiny point if you don't mind. For each of the 2 characters, I added animations for all 8 directions. However, the animations only work when the sprites move in N S E W directions, and not the 4 diagonal directions (static at 1 frame only).

  • To make a single event active or inactive you just set a condition under it so it becomes 'Do this event > unless this happened'. Select an event and press C you can add a condition.

    The animation issue is happening because the action i.e. 'When right is pressed' will always conflict with 'When right and when down is pressed' so you need to add in some conditions for the single press actions. i.e. When right is pressed and up is not pressed and down is not pressed, like this :

  • You're a lifesaver!

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