Assignment 4: Smlie :)

Concept:

Creating this Assignment I was feeling sad so I decided to create an auto text generator that tells whoever interacts with the screen what I think about them. Tap on the screen to see what you are 🙂

Highlight:

I decided to use everything we learned in class besides data analyses to create this artwork. I was inspired by the bouncing ball example used in class so I decided to replace the ball with a word and with that, I just utilized loops and if-else statements to create a generator that can will print random words in an array of words.

The parts of the code I found challenging were; The choosing of the words as random numbers to generate numbers in double casting and also because I didn’t pay attention to when you were talking about how to cast numbers. But after asking Powers I was able to solve this situation.

The main problem that I wasn’t able to also solve was fitting the words on the canvas. I tried to use “addition and subtraction” means to do so but this didn’t solve the problem but rather created another one.

bounce() {
  if (this.x > width-120 || this.x < 0) {
    this.xspeed = this.xspeed * -1;
    this.colorChange();
  }

  if (this.y > height-5 || this.y < 20) {
    this.yspeed = this.yspeed * -1;
    this.colorChange();
  }
}

Because I added and subtracted, if an object was created in the space I excluded the object bugged.

I solved this with the use of the return function but it is not exactly how I want it to be. The objects still go out of the canvas and sometimes they bounce when they haven’t hit the edges.

if(this.x>width-120||this.y<20||this.y>height-5){
      return;
    }

For the addition of objects and deletion I used the “function KeyPressed()” and “function mouseClicked()” as well as return loops and dynamic memory allocation. I am proud that I made sure to not cause memory leak as I applied what I have learnt even though it didn’t cause any error.

Finally, I used the opacity in the fill function as well as some randomness to cause this kind of flashy look in the end and I don’t know if this work made you smile but it made be happy after I was done.

Final Work:

Reflection and Ideas for Future works:

I really hated the fact that the letters kept going out of scope so maybe in future I would correct this error, if not in this project, in another similar one.

Leave a Reply