U3 Lesson 16 Mouse Input

Can some please help me understand the difference between the following commands in simple student terms? Maybe when we would use one over the other…

  • keyWentDown(code)
  • keyWentUp(code)
  • mouseDidMove()
  • mouseDown(button)
  • mouseWentDown(button)
  • mouseWentUp(button)


Have you looked at the documentation for each of those items? You can find it by mousing over a block inside gamelab (or, here’s the direct link: Code.org Tool Documentation)

For example, the documentation for keyDown shows: Checks if the key specified is pressed. (currently). On the other hand, keyWentDown would indicate if the key was pressed within the last cycle (ie. last time through the draw loop), but may not be currently pressed down.

The documentation also has examples of each event you could copy and paste into gamelab to play with them.

Does this help? Let us know if you need further clarification.