Closed codingbootcampseu closed 3 years ago
Use the sketch from the previous task.
x
y
diameter
velocity
renderComet(comet)
Hints
let comet1 = { x: 1, y: 2, velocity: 2 }; function draw() { renderComet(comet1); // update second comet } function renderComet(comet) { // update comet coordinates comet.x = comet.x + comet.velocity; // draw comet circle(...); // calculate if comet is outside of canvas ... }
Example Solution
es funktioniert auch ohne Trashold, besonders ohne die Parameter weiterzugeben. Aufgabe gepseichert
Use the sketch from the previous task.
x
andy
coordinates of the cometdiameter
andvelocity
(speed) variable for each cometrenderComet(comet)
function that takes a comet as the parametervelocity
variable to update the positionHints
Example Solution