Open codingbootcampseu opened 3 years ago
Use the sketch from the previous task.
x
y
Hints
function createRandomComet() { let newComet = { x: random(..., ...), ... }; return newComet; }
Not all keys must be created upon object creation.
// Create empty object let newComet = {}; // Create keys / properties afterwards newComet.x = 0; newComet.y = 0;
Example Solution
Use the sketch from the previous task.
x
(between 0 and canvas width) andy
(between 0 and half canvas height)x
andy
to a random value (according to the initial requirements) when comet leaves canvasHints
Not all keys must be created upon object creation.
Example Solution