Assignment 3

For this assignment, I used OOP and arrays to create an interactive Popcorn experience. On mouse Click, the user can see the popcorn bouncing from the popcorn machine straight to their popcorn box. The user can keep adding popcorn whenever they like.

<

The code that I am most proud of is allowing the user to add more popcorn at any time. I used the mousePressed function for that:

function mousePressed(){
  for(let i = 0; i < 10; i++){
    let x = i;
    let y = i*10;
    let xspeed = i*2;
    popcorns[i] = new Popcorn(x,y,xspeed,-1);

}

For improvements, I want to learn how to make the popcorn objects land on each other so that it shows that they are stacking. I also want to allow the user to enter a number which represents how much popcorn they would want to have.

Leave a Reply