Student Game Won't Run

This student’s code will not run… we cannot figure out why. Could anyone tell us what is blocking it from running?

Thanks!

Hi @tuzupis,

I like that the student is making a tribute to a hero of theirs. There’s a lot going on in that code and I can’t seem to find a solution that fixes everything. I did notice they have a few instances of “if gameOver.visible” and that’s it. They need to add in " == false" or “== true” depending on what it needs to say for that code to work.

I’m going to encourage you to have this student go back and add some more comments to their code. Right now they have some level of commenting that explains what each section of code does. If you have them add in how it does it, I’m guessing the student will figure out a lot of the errors on their own. If they don’t, please comment back here & one of us can take a closer look at it.

Cheers,
–Michael K.

@tuzupis Awesome game! Well done. I really like @mkmietowicz’s response as I, too, have had great success with students finding their own bugs by sharing their program with another student. In fact, I was made aware of a process that many teachers use called rubber duck debugging (https://rubberduckdebugging.com/) where real professional programmers have a duck on their desks that they use to explain their code to and just the fact of explaining it aloud to someone (or something) else, helps them find their own problems. I even know a teacher who bought different sizes of ducks and uses them as a debugging tool and a behavior management tool because kids can trade for larger ducks depending on their behavior, etc. I don’t remember the details, but her kids love it.

One thing that I think could have perhaps helped debug this one is asking “when” the problem first occurred. It seems to me that the program was working and then at some point, stopped working. When that happens, you can often work backwards to figure it out.

In this case, I think I have found the error and it’s not in an obvious place or for an obvious reason, but it was only by chance I found it because I saw a similar error in a completely different program a few days before looking at this one.

Have your student open the animation pane and find the “start” animation. It is a blank screen. When I remixed their project and deleted that animation, all of a sudden the game started working great. Why this caused the error, I have no idea. I couldn’t see that your student is using the animation in their program, but I have seen this happen a few times before.

By the way, it is a fun game to play! I only wish I could dunk because when I sky over the defender, I try to dunk and he always rejects it!

Anyway, just a few thoughts on debugging and hopefully a useful solution.

All the best!

Mike

Thanks so much for your help. He got it to work, and he isn’t sure how :slight_smile: I love the idea of having students go beyond commenting on code by explaining how it works. I will definitely do this from now on.

I have a new project I cannot solve - way above my skill level:

1 Like

Thank you for your help. We tried having other kids help debug, but none of us could find it. He said it just started to work today. I will definitely look into the rubber duck idea as I have a few students who do not like to debug their own work. It’s definitely a skill they need to develop. I have another question now, this one is way above my skills. It was working at one point, but his arc no longer works. https://studio.code.org/projects/gamelab/xtSavGlitFgn8vh54KV8fDMbLgRSwk6uhk36LHWQgyo

Hi @tuzupis,
I know I’m late to the party on this discussion, but I’m looking at the link you’ve posted and I’m not sure I understand what is supposed to happen in this game. I know you mentioned that the arc does not work, but I think I’m missing the overall concept of the game. Could you clarify the expectation a bit so we can help debug more specifically? Thanks!

The game was supposed to be like a parkour game where you can just mess around. The idea was that it would be like a regular platformer type game, but with the addition of a grappling hook type ability. He was hoping to somewhat simulate a movement similar to that of a pendulum. He has since changed a lot in the game, and it works a little better. The reason for the triangle being formed is simply because he made the game step by step. He first got a basic pendulum effect working. He showed it as a triangle because it helped him visualize how to code it. From there, he built the game around it and never got to removing the triangle. https://studio.code.org/projects/gamelab/sSsUzlO1w1ZIBHo4Cv0_8tv6Kh5MDBqp-Yy2UZAlHJQ

This version looks a lot more complete. The first version that we saw wasn’t clear what was going on. I would have to refresh my trigonometry to be able to help improve this, but this looks pretty good. If he has any more specific issues, let us know if we can help. Others’ math may be a little more polished than mine.

Mike