Earn points by hitting veggies with flowers, while avoiding dragonflies. Click the mouse to fire flowers and move the mouse to change direction of the flowers.

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
  • .
  • .
  • .

Directions: (not necessarily in this order)
Use the array of Prize objects called, prizeArray to access specific values to draw the veggies.
define a function to place prizes randomly in the right-most third of the canvas. Use the value stored in prizeArray[index].time to render veggies at different times. Also, use the value stored in prizeArray[index].live. Please use index variables of your own selection.
Set interval to call the above function periodically. declare a varible to keep track of time( number of function invocations).

function Prize(context, chngX,chngY, points, time, imageName)
{ this.context = context;
this.chngX = chngX;
this.chngY = chngY;
this.points = points;
this.live = true;
this.time = time;
this.image = new Image();
this.image.src = imageName;
this.x = 0;
this.y = 0; }