Imaginary Creature: Van

Here’s my code.

Sketch

Van, this robot, is traveling in space. It is half grey and half white. It creates power of fire of different colors in the feet. Van’s arms and eyes can move. It’s eyes can even follow the mouse.

We use translate() to realize translation of patterns and collections. In my sketch, after using translate() the whole creature moves to the middle of the canvas together. Push() and pop() can limit the scope of instructions includiing motions so that special instructions would only apply to some objects. It is so much easier to use User-Defined Functions instead of using repeating codes again and again. We need only to define the functions once and use function xxx(). Using x and y in translate() can make patterns realize ranslations easily. Using defined functions by just changing the parameters can change the variables which appear several times in the functions.

 

Leave a Reply

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