Open your sketch MyCreature_(name)__var.
Now go back to the sketch of your creature that you modified in Activity 8. Go to where you have your variables defined. You set your variable x
and your variable y
to be equal to numbers. Replace the numbers with the system variables mouseX
and mouxeY
as shown:
1 2 3 4 5 |
function draw() { var x = mouseX; var y = mouseY; ... # more code for your creature below here |
FORK this sketch and save it as “MyCreature_(name)__mXmY”
Do all parts of your creature move together around your screen when you move your mouse? Or do some parts have extended lines or change size and look odd when you move your mouse. If your creature does not move all together, review your code and problem solve.
Go back to: Variables