Check out a free preview of the full Build a Game Project: Feed-A-Star-Mole course
The "Gone 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:
Brian assigns a status of "gone" to the moles, such that it shows the mole missing from its hole.
Transcript from the "Gone Status" Lesson
[00:00:00]
>> Brian Holt: So if a mole was gone and it's next comes up again, that means it's going to go to hungry, right?
>> Brian Holt: So the mole status here is going to be mole.status = hungry.
>> Brian Holt: mole.next = getHungryInterval. We'll have to decide how long that is.
>> Brian Holt: Okay, here we're gonna have to say, it's kind of the same thing up here, moles, no children all that stuff.
[00:00:50]
Remember, we wanted to have it like have the bird come over it, if the mole's hungry, so we have to add a class here. So, class list.add hungry. And we're going to have to remove,
>> Brian Holt: Make it a little smaller. Remove, gone, right, cuz it's no longer gone.
[00:01:23]
>> Brian Holt: Call it up there. So mole.children.class, we need to change the source here as well to be equal to ./mole-hungry.png.
>> Speaker 2: Do you need to do that with the children or just mole.node.src?
>> Brian Holt: Yeah, I messed 77 up. So it does have to be this, this is wrong.
[00:01:52]
Because, again, the node that we're referring to is the one that we have, mole.node is this one the whole. We actually need to grab the child. Yeah, yep, yep, yep. So, line 77 there, we're actually gonna have to say mole.node.children. Same thing that we were doing up there, children.0.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops