Skip to content

Commit

Permalink
bolinha
Browse files Browse the repository at this point in the history
  • Loading branch information
kadu-passos authored Aug 1, 2024
1 parent 32c24fa commit 6f201bb
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions pingpong.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
// aqui eu vou criar a bolinha
//aqui eu vou criar a bolinha
let xBolinha = 300;
let yBolinha = 200;
let tambolinha = 25
let tamBolinha = 25;

//config velocidade bolinha
let xvelocidadeBolinha = 6;
let yvelocidadeBolinha = 6;

function setup(){
//aqui vou criar minha "mesa"
createCanvas(600,400);
}

function draw (){
function draw(){
//função responsável pelo "desenho e animação da mesa"
//aqui vou por a cor da "mesa"
background(176,224,230);

criabolinha (xBolinha, yBolinha, tambolinha);
//A cor da mesa é em rgb
background(128,128,0);
//chamando a função cria bolinha para criar a bolinha
criaBolinha(xBolinha, yBolinha, tamBolinha);
//chamando a função mov bolinha
moveBolinha();
//chamando a borda
Borda();
}

//função bolinha
function criabolinha (xBolinha, yBolinha, tambolinha){
circle (xBolinha, yBolinha, tambolinha);
function criaBolinha(xBolinha, yBolinha,tamBolinha){
circle (xBolinha,yBolinha,tamBolinha);
}

//função move bolinha
function moveBolinha(){
xBolinha = xvelocidadeBolinha + xBolinha;
yBolinha = yvelocidadeBolinha + yBolinha;
}

function Borda(){
if (xBolinha > width || xBolinha < 0){
xvelocidadeBolinha *= -1;
}
if (yBolinha > height || yBolinha < 0){
yvelocidadeBolinha *= -1;
}
}

//função cria raquete
function criaRaquete(){

}

0 comments on commit 6f201bb

Please sign in to comment.