Try to get the bees before the dragonfly while avoiding the dragonfly. You can use the arrow keys to control the caterpillar.

Program2Play

bee.x += fun;

Previous lesson

Lesson by topic

  • Graphics Coordinate System
  • Basic horizontal motion
  • Gravity: part 1
  • Horizontal/vertical/diagonal motion with direction change
  • Basic animation (erase, move draw
  • Basic graphics calls
  • Basic object interaction
  • Event handling: responding to key events
  • Motion responding to angle of graphic object. Using basic trigonometry
  • Placing objects randomly at timed intervals
  • Working with an array of objects: iteration
  • Working with an array of objects: iteration Part 2
  • Complex navigation algorithm
  • .
  • .
  • .

Lesson by number

  • Lesson 1
  • Lesson 2
  • Lesson 2b
  • Lesson 2c
  • Lesson 2d
  • Lesson 3
  • Lesson 4
  • Lesson 5a
  • Lesson 5b
  • Lesson 6
  • Lesson 7
  • Lesson 8
  • Lesson 9
  • Lesson 10
  • Lesson 11
  • Lesson 12
  • Lesson 13
  • .
  • .
  • .

Next Lesson

Video

Assignments

  • Assignment 1
  • Assignment 2
  • Assignment 3
  • Assignment 4
  • Assignment 5
  • Assignment 6
  • Assignment 7
  • Assignment 8
  • Assignment 9
  • Assignment 10
  • Assignment 11
  • .
  • .
  • .

In the text area do 3 things:
1) Create an instance of the creature class as shown:
var myCreature = new Creature(context, x,y, width, height, chngX,chngY);
Substitute the italicized names with numeric values (note: chngX and chngY are the change in X,Y location respectively for each interval)
Also use the value context2 for the context parameter (the only non-numeric value)
2) Create the draw function for your custom creature. Use the properties specified in your object creation above.
Also, include a function call to checkBees(myCreature); inside your draw function.
Substitute the creature name you used in step 1 for myCreature .
3) Set the interval for you draw function. Eg setInterval(functionName, 50 ); Substiture functionName for your chosen function name in step 2.