• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

BMS Processing Class

A Course23.com Production

"Stop, Pause, and Think..." -- Ms. Elwell
"Take your time, it isn't a race" -- Mr. Helmke

  • Home
  • Graphing and Color
    • Graphing Shapes
      • Activity 1
      • Activity 2
    • Color (R,G,B) and Grey Scale
      • Activity 3
      • Activity 4
  • Code and Sketches
    • Parts of Code
      • Activity 5
    • Your Code & OpenProcessing Sketches
      • Activity 6
      • Activity 7
  • Variables, etc
    • Variables
      • Activity pre8 and 8
      • Activity 8.1
      • Activity 9
      • Activity 10
      • Activity 11
      • Activity 11.1
    • Operator Precedence
      • Activity 12
      • Activity 13
    • Random
      • Activity 14
      • Activity 15
  • Conditionals – If, Else, Else If
  • Resources

Activity 11.1

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

Primary Sidebar

Required Reading:

Course Coding Standards

Copyright © 2016–2021 Chris Elwell/Michael Helmke · This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License · Log in