- Introduction to variables.
- Demonstration of variables. Draw a simple landscape with one tree/plant/rock/building/creature in it. You can use the code below to get started if you want.
- (1) Make the sky change color every time the mouse is pressed.
- (2) Make the tree (or what ever your thing is) move horizontally across the horizon – as if you are in a car driving along looking our the window.
- (3) Add in a sun/moon/star or planet that is setting or rising slowly in your landscape.
//A forest
void setup() {
size(400, 400);
noStroke();
fill(153, 216, 201);
rect(0, 200, 400, 200);
}
void draw() {
fill(42,162,95);
triangle(190,180,205,140,220,180);
fill(255,147,188);
rect(200, 180, 10, 20);
}