eu acho q ta td paz soq n vai, ela fica bugada girando em torno dela msm https://streamable.com/awnk63 < video do bug
//circle's variables let xCircle = 300; let yCircle = 200; let diameter = 30;
//speed variables let speedxCircle = 5; let speedyCircle = 5; let ray = diameter/ 2;
//racket variables let xRacket = 5; let yRacket = 150; let length = 10; let height = 90;
function setup() { createCanvas(600, 400); }
function draw() { background(0); showscircle(); movescircle(); verifycolisionedge(); showsracket(); movesracket(); }
function showscircle(){ circle(xCircle, yCircle, diameter); }
function movescircle(){ xCircle += speedxCircle; yCircle += speedyCircle; }
function verifycolisionedge(){ if (xCircle +ray > width || xCircle -ray < 0){ speedxCircle *= -1; } if (yCircle +ray > height || yCircle -ray < 0); speedyCircle *= -1; //i fking spent 10min this part cuz i tried to do alone without my teacher lol and i pressed INSERT idk why this exist }
function showsracket(){ rect(xRacket, yRacket, length, height); }
function movesracket(){ if (keyIsDown(UP_ARROW)){ yRacket -= 10; } if (keyIsDown(DOWN_ARROW)){ yRacket += 10; } }
(eu nao sei pq fiz em ingles mas ta paz p entender) pf me ajd