Unit 3 Creating a Game

My students are currently creating a game on Unit 3 Chapter 22. A few of them have run into some issues, I have tried my best to help them, once I do that another problem occurs. I have attached each students game links along with a comment they wrote about what is wrong with their game.


The snake won’t bounce off the target.


Can’t get background to change


https://studio.code.org/projects/gamelab/2qxDT96vsDE_Aka4tfVXnrFQz1r6MJ4xunvyzjsd_8

My platform isn’t looping.


One score is showing, the other score is not. The green fish is broken.


Need object to come back after it leaves the screen.


Item needs to shoot laser at object and reset.

@mabenites, thanks for posting on the forum. These all look like the beginnings of some fun games. Have you considered spending 15-20 minutes and having them play each other’s games in a gallery walk or having students trade computers and play the game of another student? The reason I bring this up is that I have found that sometimes they can help each others with some of these kinds of problems. I’ve also found that this also sometimes gives them ideas on how to improve their own games. Another thing my students are required to do is ask two other students before they ask me. It works for most, although I do have to monitor for students who are too shy to ask others. This takes a lot of the debugging work away from me and helps the students to learn debugging skills on their own.

I did look at all your projects and can leave you a little direction below that will hopefully point them in the right direction.

1st one - Snake not bouncing off target - I don’t see any code that tells the snake what to do if it does collide with the target. The student has created code telling the apple what to do if it collides with the snake and that is working great. Something similar added to the snake collision code could tell the snake what to do if it hits the target, but this code hasn’t been written yet.

2nd - background won’t change? - It appears to be working just fine right now. The code calls for the background to change when the score reaches a certain numbers and it was working when I played it. Maybe they were able to figure it out after they passed it on to you.

3rd one - platform not looping … I’m not seeing a platform in this one. May be the wrong link.

4th one - score not showing, green fish broken - both of these are the same issue. If you look at the code, the x and y position of both fish is the same, so the pink fish was drawn on top of the green fish. Same with the scores. The score code is the same for both scores, so one is drawn on top of the other. Also, since the code is identical, even when moved, it will display the score for player 1 in both locations. 2nd one needs to be listed as score2. (There are some other issues the student will probably report in this one. This will get them started and then, I would have them try to work through the other issues or use a fellow student to help them. Sometimes just explaining the code to another person helps them find it on their own).

Next one … need object to come back after it leaves the screen. - Most of your other projects have good examples of an object coming back after it leaves the screen, but I don’t see any code written in this one for that to happen. Basic idea is that when it leaves the right side of the screen, the x and y value of the object need to be changed to put it at a different location (ie. to the left of the screen) and then it will re enter from the opposite side. Many of your students are already doing this and could likely help this student.

Last one … laser not shooting. On this one, the problem is that I think the student is picturing the y coordinates backwards. At the very end of the code, they are telling the bullet to reset to a negative value if the y value is > 0. I think they mean it exactly the opposite. They want the bullet to reset if the bullet leaves the top of the screen which is < 0 (not > 0). Also, the reset coordinates put the reset bullet at -50 (above the top of the screen) and I’m guessing the student probably wants it below the screen (above 400). If you remind them that the y coordinates start at the top of the screen and move down as they get larger, they should be able to make those small changes and it should work.

Hope this helps!

Mike

1 Like