Collision event not working

Just started using Construct 2? Post your questions here

Post » Tue Dec 15, 2015 6:45 am

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.
B
6
S
1
Posts: 14
Reputation: 328

Post » Tue Dec 15, 2015 1:12 pm

Your file is locked from access.
B
43
S
13
G
59
Posts: 1,779
Reputation: 35,731

Post » Tue Dec 15, 2015 3:42 pm

Oops so sorry about that. I've changed the setting!
B
6
S
1
Posts: 14
Reputation: 328

Post » Tue Dec 15, 2015 5:19 pm

Event 26 is broken because it's being overriden by the HUD code. : every tick set ekans current HP to ekans.maxhp - ekans.damage.
B
43
S
13
G
59
Posts: 1,779
Reputation: 35,731

Post » Tue Dec 15, 2015 5:24 pm

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.
B
43
S
13
G
59
Posts: 1,779
Reputation: 35,731

Post » Wed Dec 16, 2015 1:10 am

@plinkie

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.
B
6
S
1
Posts: 14
Reputation: 328

Post » Wed Dec 16, 2015 1:16 pm

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.
B
43
S
13
G
59
Posts: 1,779
Reputation: 35,731

Post » Wed Dec 16, 2015 1:18 pm

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!
B
43
S
13
G
59
Posts: 1,779
Reputation: 35,731

Post » Wed Dec 16, 2015 2:22 pm

@plinkie
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).
B
6
S
1
Posts: 14
Reputation: 328

Post » Wed Dec 16, 2015 2:40 pm

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 :

Image
B
43
S
13
G
59
Posts: 1,779
Reputation: 35,731

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest