Skip to content

Commit

Permalink
Small code tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
b-g committed Dec 5, 2023
1 parent f8a78c0 commit 272222b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions 5-rotate-svg/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions 5-svg-with-multiple-shapes/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions 6-custom-class/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 272222b

Please sign in to comment.