From 272222b8434d2ecefaf3e35cdc9b8d5249787b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20Gro=C3=9F?= Date: Tue, 5 Dec 2023 09:37:35 +0100 Subject: [PATCH] Small code tweaks --- 5-rotate-svg/sketch.js | 4 ++++ 5-svg-with-multiple-shapes/sketch.js | 3 +-- 6-custom-class/sketch.js | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/5-rotate-svg/sketch.js b/5-rotate-svg/sketch.js index 8c22b0a..5f0b2e3 100755 --- a/5-rotate-svg/sketch.js +++ b/5-rotate-svg/sketch.js @@ -41,6 +41,10 @@ function draw() { ground.draw(); polygon.draw(); mouse.draw(); + + fill(255); + textAlign(CENTER, CENTER); + text('Press R to rotate shape', width / 2, 50); } function keyPressed() { diff --git a/5-svg-with-multiple-shapes/sketch.js b/5-svg-with-multiple-shapes/sketch.js index 5bac8dc..5dee59b 100755 --- a/5-svg-with-multiple-shapes/sketch.js +++ b/5-svg-with-multiple-shapes/sketch.js @@ -33,10 +33,9 @@ function setup() { function draw() { background('black'); - // ForEach is like a for loop but easier to read (https://www.geeksforgeeks.org/difference-between-foreach-and-for-loop-in-javascript/) importedShapes.forEach((shape) => { shape.draw(); - }) + }); mouse.draw(); ground.draw(); diff --git a/6-custom-class/sketch.js b/6-custom-class/sketch.js index 07c8ac6..4c99d28 100755 --- a/6-custom-class/sketch.js +++ b/6-custom-class/sketch.js @@ -13,14 +13,14 @@ function setup() { // create fish and a ground fishA = new Fish(world, { x: 200, y: 200, species: 'catfish'}); fishB = new Fish(world, { x: 270, y: 50, species: 'herring' }); - ground = new Block(world, { x: 400, y: 500, w: 810, h: 15, color: 'grey' }, { isStatic: true, angle: PI/36 }); + ground = new Block(world, { x: 400, y: 500, w: 810, h: 30, color: 'grey' }, { isStatic: true, angle: PI/36 }); // run the engine Matter.Runner.run(engine); } function draw() { - background('white'); + background('black'); fishA.draw(); fishB.draw(); ground.draw();