Die Function

I have been following along with Kaans Alien Attack series on Godot, and wanted to note that I have changed some things around in my tutorial as I get used to the GoDot engine, and simply to test out what I can do.
During the series he goes through using the visibility notifier to get rid of objects that go off screen. Because of the style of Alien attack game it only made sense to me that this would be the way we delete the enemies too, so I did just this. I understand this wouldn’t be the appropriate way to deal with all characters going off screen in all (or even most games - especially open world ones) it is a perfect solution for this game, and doesn’t leave you vulnerable to your score increasing when the die function is called on those characters. Instead I have them queuing free when they exit the visible screen area - the same principal that was applied to the bullets.
I thought this was worth noting simply because it avoids some of the extra steps taken in the later video on dealing with enemies dying using an Area2d node in order to detect enemies passing through it (and then using the die function that was created that causes the issue of the score increasing regardless of the enemy not being shot by the player.

If there is a specific reason I should be using the method Kaan is using could someone please inform me so I’m more educated about the topic. Thanks for being a great community to learn in.

As you suggested, there’s no problem with using this solution here, and others have as well. The deathzones are also a valid solution; both do the job. Have a look at this:

1 Like

Thanks for the response. I still watched the video to see another method of doing it, but was pleased with what I had done so far for the game considering how it was going to end up looking. Thanks again, I see you’ve commented on a good portion of my videos now so thank you for clearing up a lot of my questions.

1 Like

Privacy & Terms