Check out a free preview of the full Build a Game Project: Feed-A-Star-Mole course:
The "Leaving Status" Lesson is part of the full, Build a Game Project: Feed-A-Star-Mole course featured in this preview video. Here's what you'd learn in this lesson's course:

Brian assigns a status of "leaving" to the moles, which displays the image of the mole going back into its hole.

Get Unlimited Access Now

Transcript from the "Leaving Status" Lesson

[00:00:00]
>> Brian Holt: So the mole.next here is going to be getGoneInterval, mole.status = gone. What I want to do is I want the mole to disappear. So if you remember up here, we made this gone, right, this gone class. So we need to put that gone thing on the mole.

[00:00:25]
So what we're gonna do is we're gonna say mole.node.children. This is gonna give you all of the children of that particular element. We're gonna grab the first one cuz node.children, this one right here, this is always going to give you a list. Even if there's 1 even if there's 0 it's always going to give you a list of them.

[00:00:49]
So we always get the first one, which is what this 0 is going to do right there. And we're going to say .classlist.add gone.
>> Brian Holt: Make sense? This is going to go grab the mole, which actually, if you remember correctly, gives you the hole, I think. Yeah, so the hole is this div right here.

[00:01:19]
When we're asking for node.children 0, the thing that we're actually gonna get back is the image tag here. Which is what we actually want. And we're gonna break.