Unit 3 Final Project Lagging

Project Link

I expect the sprite 3 “enemy” to continue to move at a consistent rate (velocity is maintained at 1.1) however at about draw loop 800 something begins to lag the program. I cannot see what could be doing this in the code.

[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]

Link to the project or level: [replace with link to the curriculum or get the “Share” link to a project]
What I expect to happen: [replace with a detailed description of the behavior you’re trying to create]
What actually happens: [replace with a detailed description of what actually happens when the code runs including any errors or unexpected behavior]
What I’ve tried: [replace with a detailed description of what you’ve already tried to do to solve the problem]

@christine.carney ,

Finding bugs like this can be tricky. Have you tried removing each function call one at a time to see which function may be causing the lag?

When I did that, I found that the “enemycollision” function may be part of the problem. when I removed the call to that function, sprite3 appears to move at a regular speed for a lot longer. It could be the console.logs or something else. I’m not sure.

If that doesn’t completely solve the problem, i would suggest using that method (process of elimination) to see which function may be hosting the problem.

Good luck!

Mike

It was the console.logs! Thank you! I would never have guessed that!

2 Likes