Student game needs help


#1

My student needs help with their game. They have a tank and a shell. They want the shell to shoot out from the tank. They are having trouble getting the shell to be with the tank and then to move away from the tank. Any ideas?


#2

Hi Lindsay,

Your students are almost there. There are a couple problems with the code now. The first problem is that the student is using a counter pattern to move the shell, but that counter pattern is only being run when the space bar is down. It should be running every time (probably in the “moveShell” function. The second problem is that the student is resetting the shell’s position to the tank’s position every time the draw loop runs (inside the “moveShell” function). that code should only run once, when the space bar is down. If the student were just to switch these two code segments, the program should run. There are also a few issues with consistency in variable names, but I’m sure that will be easier for them to figure out.

Elizabeth


#3

Hi everyone,

My student has the following request for her game above. Any help is appreciated!!!

So for my final project in digital x I am coding a pacman game and I was wondering if there is a way I can make all the ghosts move on their own. Also, I have it so that when pacman touches the dot it adds a point to the score and disappears, but when it disappears it still continues to add to the score by a lot. Any help?


#4

Sure.
You need to have them do the same thing that pacman does but without the keydown trigger.
Maybe some random movement.
Every time through the loop they add a random amount between -2 and 2 to both their x and y position.
That could be a start.
Whatcha think?


#5

Line 24: why does it keep saying it is not a function. Please advise! Thank you.


#6

you have a function and a variable called the same thing. score can’t be used for a function and a variable name.