-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32c24fa
commit 6f201bb
Showing
1 changed file
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(){ | ||
|
||
} |