Check out a free preview of the full Build a Game Project: Feed-A-Star-Mole course
The "Debugging & Next Steps" 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 demonstrates valuable debugging strategies.
Transcript from the "Debugging & Next Steps" Lesson
[00:00:00]
>> Brian Holt: But you can see here, now our moles are actually coming and going, right?
>> Brian Holt: Has anyone seen this?
>> Brian Holt: Check your console. That's probably the first thing I would check to see what kind of errors you're getting.
>> Brian Holt: The game's not interactive yet at all, right? Because we haven't done the feed ability, right?
[00:00:35]
I'm clicking on this mole right here, and it's not doing anything. But the generic just going through its normal life cycle is working.
>> Brian Holt: Yeah?
>> Student1: I'm seeing a kind of jarring with each animation, like something funky with the CSS, or whenever one pops up like expands the whole roll a little, like the entire page.
[00:01:00]
>> Brian Holt: My guess is that you probably have.
>> Brian Holt: So it should look like this right? It's probably problem with your HTML, that would be my guess.
>> Student1: Okay.
>> Brian Holt: There's a whole container inside the whole container, is the whole. And inside the hole is the image. My guess is that you probably have something like the image is next to the hole or something like that, or it's next to the container.
[00:01:23]
But if they're not in that same relationship, that might cause issues.
>> Student1: Okay.
>> Brian Holt: If it's not that, then it's your CSS somewhere.
>> Student1: I think I see why.
>> Brian Holt: So, yeah, go ahead.
>> Student1: When are we supposed to call the next frame function?
>> Brian Holt: Next frame.
>> Student1: Just immediately?
[00:01:42]
>> Brian Holt: Yeah.
>> Brian Holt: So you have to kind of start it out next frame. You have to call it once. And then at the bottom here, make sure you have this request animation frame. Otherwise it's gonna run once and never run again.
>> Student2: That's why you're talking about it as a slow infinite loop.
[00:02:13]
>> Brian Holt: Yeah.
>> Student2: Cuz you want it to [INAUDIBLE]. Wouldn't ever think there'd be a use for an infinite loop, but it makes sense.
>> Brian Holt: Yeah, it's not necessarily a totally accurate model to think of it as, but I mean, or maybe it is, right? It is a loop that just runs forever.
[00:02:34]
>> Brian Holt: Whereas if you do like a while true loop, it'll crash your browser.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops