Check out a free preview of the full Build a Game Project: Feed-A-Star-Mole course:
The "Hungry 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 "hungry" to the moles, such that it shows the mole waiting for food.

Get Unlimited Access Now

Transcript from the "Hungry Status" Lesson

[00:00:00]
>> Brian Holt: So the first thing we're gonna do here is up here we were setting hungry. Now we have to remove hungry, because they're no longer hungry, they're sad. So moles.status = sad.
>> Brian Holt: Okay, then they're sad.
>> Brian Holt: Next, we'll put that up here, mole.next = getSadInterval, right? Which we already wrote.

[00:00:42]
>> Brian Holt: And we just gotta change the source now. So the source is going to be mole-sad.png
>> Brian Holt: And then another break.
>> Brian Holt: Any questions?
>> Speaker 2: Is it important to change the status first and then next, or put those in either order?
>> Brian Holt: No, doesn't matter. As long as it all gets done.

[00:01:27]
>> Speaker 3: Didn't we have to have a remove from the case leaving?
>> Brian Holt: So here, when you add gone, it's a display none, right. So it doesn't really matter what it was.
>> Brian Holt: Make sense?
>> Speaker 3: Yeah, I think I'm one step off in my head, but I'll figure it out.

[00:01:56]
>> Brian Holt: It's a lot to keep track of. So one of the hardest parts of like debugging in program is thinking about things over time, right? Because you kind of have to keep this amount of information at your head and then you have to modify it over time and go backwards and forwards.

[00:02:11]
And so games in this particular sense of really tough because time is a really tough element to keep track of.
>> Brian Holt: That's why it's good to have functions like this. That this function in and of itself is synchronous, right? Everything happens without the element of time introduced, right?

[00:02:32]
All you're doing is just if this, then this, if this, then this, if this, then this. So if you, here we try and keep all the time sensitive stuff limited into next frame.