Coding Assignment – Week #10

INSPIRATION & CONCEPT

Matter matter, it all around us. What comes to my mind when I think of matter? My childhood games! Ever made those lego towers or stacked building blocks only to knock them off? Or played that pyramid game at the children’s fair where you throw a ball at a stacked pyramid of paper cups? Those were a few of my favourite games and and this assignment is inspired by that. As I was going through matter.js, I was feeling playful and I have tried to capture that in this assignment.

IMPLEMENTATION

I employed the matter.js library to make building blocks – the colorful boxes. They randomly fall at the start on a static platform to kind of mirror the platform in the pyramid game. There is a pendulum that I provided to simulate the action of throwing a ball – only you swing this! The idea is for users to build their own building blocks and destroy them using the swinging ball in this playful simulation (see video below). All the blocks and and the ball is controlled by the user using the mouse.

I added a floor and a right wall so that the blocks do not all spill off screen. The left and above wall are deliberately not there so the the pendulum has room to swing.

Without the boundaries sketch version:


FINAL SKETCH

Link to full code: https://editor.p5js.org/shreyagoel81601/sketches/KnOeUyDwg

FURTHER DEVELOPMENT

Matter.js is an amazing library and has a lot of potential. For this project in particular, it would be nice to experiment with different density of medium instead of the default one and see how the blocks and the ball interact then. If lets say I set the density to be that of glycerine 1.3 g/cc, then I might be harder for the blocks to even sit on each other. I could also go ahead try out different shapes. I deliberately kept squares here because of the building block ideas, but I could try stars, triangles and stuff too.

Leave a Reply

Your email address will not be published. Required fields are marked *