How do I fix this problem?


#1

Well, the issue is, the explosion sprite doesn’t disappear after it finished its animation. Which means that when I create the “Target” on the area where the explosion sprite is, it quickly deplete the “Target” variable “Durability”. Here are my event editor screen and a clip about the issue:

https://www.youtube.com/watch?v=hW8mg15SlVQ


#2

From the YouTube link:

image

And you should at least describe the issue - we can’t tell what you expect from the code, and unless it’s really obvious in the video, we may not be able to work it out from there either (and remember what’s obvious to you may not be to others).


#3

Anyway, it’s looks like my topic just become some kind of uploaded draft until earlier, when I came back here . You can see what I’m saying now. Can you help? Thank you.


#4

Your explosion doesn’t disappear because you’re not deleting it. If the explosion is an animation, check the animation has finished, then delete the explosion sprite.

To prevent the explosion from depleting your target durability value, add a “Trigger once while true” condition on the “Explosion is in collision with Target” event condition. Otherwise, the Durability value will decrease every frame.


#5

It worked, thank you. But, another issue coming up. That is the explosion sprite doesn’t seems to damage the “Target”.


#6

Can you show what the events look like now?


#7

Here, my event editor screen


#8

I see a bit of a problem - you’re deleting GrenadeRound, and then referencing it in subsequent event conditions. These will always be false, because GrenadeRound no longer exists. Fix this, then then we’ll see about the explosion not causing damage to the target. Place the delete action as a final subevent.


#9

Hey, it kinda worked. Here is my event again after I did like you told me:


#10

Err, not quite. You need to move the delete GrenadeRound into a final subevent off the “Target is in collision with GrenadeRound”, and shift the 2 references to GrenadeRound as sub events before the GrenadeRound delete action.


#11

I’m a bit confused about that. Can you explain a bit more on how to fix it?


#12

Does this help?


#13

No idea, but, I slightly change the X position of my “GrenadeRound” and my “Explosion”. The result wasn’t that good and bad at all.


#14

I meant, does the visual help explain what you needed to do to fix your code?


#15

No, I don’t see anything change much.


#16

You can’t see the difference between your code:

and mine?


#17

No, especially during preview. Mind you explain how it change the preview?


#18

Eh?? The images have nothing to do with the preview. They are of the events in the editor. Your events are incorrect. Get your events the same as mine as shown in the images, and then we can continue.


#19

I did like said you said. With exception of slightly adjusting the X position of my “GrenadeRound” and my “Explosion”.


#20

Ok, can you screen shot the events again, and we’ll see what’s going on?