NOC – Week 9: Angry Chick – Spring (Lily)

For this sketch, I used the spring class we created in class to simulate “Angry Birds”. Once the chick is dragged, the spring will give it a force. And once the mouse is released, the spring will disappear and let go of the chick. The user can aim the chick at the pig and hit at it.

It seems that there is only one ball (the chick) in the sketch, but there are actually two. The difference between the spring I created and the spring we created in class is that the invisible ball is fixed at the center. 

Also, I added a function to the ball class, which is “fly( )”. When the mouse is released, the function will be triggered to check the distance between the chick and the center and to splice the spring. 

One problem that I am still not able to solve is that the chick will not be launched in the expected direction unless the spring is stretched to its fullest.

Demo

Leave a Reply