• 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
  • Conditionals and Logic
    • Conditionals 1: Boolean Expressions and the If Statement
      • Activity 16 (IF1)
    • Conditionals 2: If/Else Statements
      • Activity 17 (IFELSE1)
    • Conditionals 3: Else If Statements
      • Activity 18 (elseif1)
      • Activity 19
      • Activity 20 (elseif3)
      • Activity 21
    • Logical Operators
      • Activity 22 (And1)
      • Activity 23
      • Activity 24 (SingleRollover)
      • Activity 25 (FourSquareRollover)
      • Activity 26 (MoveWhenPressed)
      • Activity 27 (bouncy ball 1)
      • Activity 28 (bouncy ball 2)
  • Functions
    • Moving Shapes 1
      • Activity 29 (StarBright)
      • Activity 30 (CreatureAtOrigin)
    • Moving Shapes 2
      • Activity 31 (drawCreatureFunction)
      • Activity 32 (BouncingCreatures)
    • Rotating Shapes
      • Activity 33 (RotatingCreatures)
      • Activity 34 (RotatingShapes)
      • Activity 35 (RotatingShapes2)
  • Looping and Arrays
    • Loops 1
      • Activity 36 (ShapeLoop)
      • Activity 37 (RandomLoop1)
    • Loops 2
      • Activity 38 (Deg2Rad)
      • Activity 39 (NumberLoop1)
      • Activity 40 (NumberLoop2)
    • Arrays 1
      • Activity 41
      • Activity 42
      • Activity 43
    • Arrays 2
      • Activity 44
      • Activity 45
      • Activity 46
  • Final Topics
    • Introduction
    • Particle Systems
    • Maze Game
  • Resources

Activity 30

Take your creature and re-write it so it is centered at the origin. We are going to do this in two parts.

Part 1

Get some graph paper and draw out a simple creature using the usual basic shapes: ellipse, rectangle, and line. In the past when you did this, you presumed the origin was the upper left corner of the page. This time, I want you to put a dot in the middle of your graph paper. That dot is your (0,0) point. Center your creature on that point. When you write code to draw your creature in Part 2 (below), you will draw all of your coordinates related to that center (0,0) point.

Part 2

Now you take the creature you drew in part 1 and write code to draw it on screen. As in the examples, add a push() and pop() function and start using the translate(…) to position your creature somewhere on screen. For example, translate(200,200);.

Why translate? You are writing your creature so its coordinates are all around the origin which will put most of it off screen since the screen origin is the upper left corner of the screen. Translate will shift the coordinate space to wherever x,y is given. Thus you will be able to see it.

Write code to take your creature on paper in Part 1 and put it on screen.

Name your sketch: CreatureAtOrigin

(Note: Do not decide to spend time converting your creature to use beginShape()/endShape(). There will be time for things like that in future activities.)

Go Back to Moving Shapes 1

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