Debugging Help!


#1

Can someone tell me why the plane will move right and left when the switch is closed when you first run the program. Or, vice versa it will move directly up and down when the switch is open and you first run the program. But, if you switch the switch during the program the plane starts moving at and angle. What gives? Help please! https://studio.code.org/projects/applab/4UO9C5j2448dqmVjs2N_bb5otB9AGWkk_pZCAKmqEGQ


#2

This is one solution and may not be the best, but this is what I think.

I think the student should get rid of the two board events for the toggle switches and just check the status of the toggle switches when the buttons are pressed.

I’d also then delete the and the up_down and left_right functions as they will be not needed.

So, the program would look more like:

Board Event: buttonL is pressed. Inside that check the status of the toggle switch with an if statement. if the toggle switch is open call the move_plane_up function

Let me know if that makes sense.