Midterm Week 2

I created the magic 8 ball for this midterm project. When the user types a question and presses enter, the ball shakes for a certain amount of times and then an answer appears on the triangle. There is a yellow button that says “AGAIN” and when the user clicks it, the screen gets rested, the question and answer is gone.

In my original proposal, I stated that I will create the answers appear slowly like how they do in the real ones. I couldn’t figure out exactly how I can achieve this, so I made the answers immediately after the ball is shaken.
Speaking of that, shaking the ball for a certain amount of time was very difficult. Initially, the ball was being shaken the entire time the program was running, or it would not shake. I was able to fix this by creating a variable that counts how many times it was being shaken. This could be accomplished by creating a for loop, but for some reason when my program wouldn’t run with a for loop.

I had two classes in the code, one for the questions and the other for when the button is pressed. I created an array for the set of answers, which are given out randomly. The button is something I didn’t plan for, but I thought it was necessary for multiple questions.

If I can do things differently, I would add more set of answers. For this project I sticked to traditional answers that a normal magic 8 ball would have, but I think this can be super fun with different answers.

This is the link to my project:
https://www.openprocessing.org/sketch/516418 

Midterm Part 2

For the second half of my midterm I expanded the sunflower to try and make it more interactive and a more neat / efficient piece of coding.

After a helpful adjustment from Scott, I tried to look back in the code I had written and see what changes I could make to clean up before adding more.
I organised parts of the sketch into methods that would allow me to see how the sketch plays out in a condensed layout before adding anything more.

With everything sorted I outlined the new techniques that I wanted to implement into the sketch: Arrays and a Slider.

I thought it would be cool to make the background change with the slider slightly more interesting by adding randomly generated stars in the background to complement the dark “sky”. I did this by taking and modifying the “ball” Array from class into creating smaller ellipses that would be always present, but only appear when the slider changed the background from white to black.

The next stage that was more difficult came with realising that with the slider changing the background color, the function kept redrawing over the rotating triangles meaning that original two would only appear – destroying the earlier illusion of a spinning sunflower/pinwheel. I then decided to try using an Array to generate the petals around the center of the sunflower. I found that by incrementing the starting point of rotation for each triangle generated by the array, the effect would be visible again.

The only recurring issue I had was that I previously used “mouseX” to change the shade of yellow according to the mouse position. However after using the petal Class, the same function doesn’t yield that result.

Midterm Part 2

My final midterm project looks a lot different from part 1 of my midterm project. It is also very different from what I wanted a that time. After looking at different types of unique clocks, I decided I would try something a little different. I still had the same basic idea of “Time and Space”, but I wanted to change the design of the clock. I didn’t put traditional “hands” on the clock, but I had 3 rotating arcs instead. This brings something more unique to the piece.

With the stars, I decided to have them be more like shooting stars instead of traditional stars floating through space. I didn’t want the “stardust” to get onto the clock at all, so I made the stars remove the trails of color once they pass over the clock.

The shooting stars make the background more interesting, and once you click the mouse, it changes the color theme. If you press any key then it erases the trails of color. If you hod down a key, then it does this cool “time glitch” effect.

Overall I think my project turned out well, even though it differs a lot form what my original vision was. To make it better I could’ve made the objects interact more with each other, and the user.

midterm-part2

For this midterm project,

 

I planned to make small game . You have three lives continuing game, when you could not hit the balloon, then the life deduct -1.  When you hit the balloon with needle, then score goes up. if you get 30 scores then you win.

 

I made objects for balloon, and niddle. (Needle can hit the balloon, and middle moves horizontally.)

Using for loop helped to make lot of balloons. At the beginning, set up the specific balloons and I put those to array list . (I could put object in the array list)

u.update could bring inside of update. before bring, must send mouseX to update int newX which is called parameter.

if I did not draw needle again , then it does stay in same place, so I put method call display .It may keep showing needle again and again.

Same way for balloon for dropping.

inorder to interact needle and balloon, using Checkcollision helped make

squared balloon, and when niddle came inside of it then balloons can disappear.

Using Float and return helps returning info.

If you hit the balloon with niddle , and then scores automatically go up and another balloons will be dropped.

Midterm Part 2

During the process of creating my sketch, the most successful part was discovering a way to produce a complicated object that is interesting even by itself. Also, placing rotate functions in different parts of the code ended up with a result that I didn’t foresee. There were several surprises like this throughout my process and I learned a lot from them. Overall, my original idea of making a spaceship made out of thousands of squares worked out well. I was able to add two more orbits by incorporating a separate class for the circular object, and add a starfield background by using an array. I was faced with few problems with the rotate and scale function when I started to work with more classes, but I somehow figured out ways around them. This project taught me that things work differently in Processing and Openprocessing. For example, in Processing some interactions with the keyPressed function will work only once and mess up other key interactions, while in Openprocessibg everything works as I intended. Also, the mouseWheel function works so well in Processing, but it won’t respond at all in Openprocessing. Those are the two problems that one can find in my final sketch. Finally, I wanted to add an interaction where I can add the orbits by pressing ENTER, but that never made it to my sketch because the object is not a simple eclipse but a group of recurring object that is also rotating.

https://www.openprocessing.org/sketch/515679

Midterm Part II

For my final sketch, I added a shooting star using an array and a fruit class. I also added rotation to my stars; so that when the user clicks on the screen, a rotating star is created. I added a fruit class; the color of the fruit corresponds with the color of the tree’s leaves. Last week I had a full moon and this week I added phases to the moon. When the user presses a key, the moon’ phase changes. Rather than have a random colored house each time, I just chose to have the house’s door color change randomly.

When I started to create the shooting star, I thought I was going to have to scrap the idea because after making the shooting star, everything else did not work. I have to put the shooting star in the draw class and that means I have to put the background in the draw function so that there is no trail. If I put the background in the draw function, I have to put the rest of my objects in the draw function so that they don’t get overdrawn, but because a lot of my objects change color, it looked really bad. I ended up adding the shooting star by having a black rectangle being drawn to cover up the star’s trail.I also wanted the stars to rotate; I applied the same black rectangle to the stars so that there would be no trace of past rotations. I limited the star’s location because I only wanted stars to be drawn in the sky (and not on the house and moon) and this made coding the interaction between the stars and the shooting star easier.

I added a lot to my new sketch; I refined the colors, added a changing moon, a shooting star, rotation to the stars, and fruit to the trees. If I had more time, I would have made the shooting star look more like a star with a small line following it. I would have also made the tree using recursion so that it looked more realistic with branches.

Link to Sketch:

https://www.openprocessing.org/sketch/516141