-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from raspberrypilearning/draft
Add translation
- Loading branch information
Showing
82 changed files
with
3,337 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
from random import randint, seed | ||
|
||
# Inclua variáveis globais aqui | ||
|
||
|
||
def setup(): | ||
# Coloque aqui o código para ser executado uma vez | ||
|
||
|
||
def draw(): | ||
# Coloque aqui o código para ser executado em cada quadro | ||
|
||
|
||
# Mantenha isto para executar seu código | ||
run() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Não colida!" | ||
identifier: "dont-collide-starter" | ||
type: "python" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
from random import randint, seed | ||
|
||
nivel = 1 | ||
pontos = 0 | ||
|
||
def jogador_seguro(): | ||
global jogador_y | ||
|
||
# Face | ||
fill(200, 134, 145) | ||
ellipse(mouse_x, jogador_y, 60, 60) | ||
|
||
# Olhos | ||
fill(178, 200, 145) | ||
ellipse(mouse_x - 10, jogador_y - 10, 20, 20) | ||
ellipse(mouse_x + 10, jogador_y - 10, 20, 20) | ||
fill(0) | ||
ellipse(mouse_x - 10, jogador_y - 10, 10, 10) | ||
ellipse(mouse_x + 10, jogador_y - 10, 10, 10) | ||
fill(255) | ||
ellipse(mouse_x - 12, jogador_y - 12, 5, 5) | ||
ellipse(mouse_x + 12, jogador_y - 12, 5, 5) | ||
|
||
# Boca | ||
fill(0) | ||
ellipse(mouse_x, jogador_y + 10, 15, 10) | ||
fill(200, 134, 145) | ||
ellipse(mouse_x, jogador_y + 5, 10, 10) | ||
|
||
def jogador_colidido(): | ||
global jogador_y | ||
|
||
# Face | ||
fill(178, 200, 145) | ||
ellipse(mouse_x, jogador_y, 60, 60) | ||
|
||
# Olhos | ||
fill(149, 161, 195) | ||
ellipse(mouse_x - 10, jogador_y - 10, 20, 20) | ||
ellipse(mouse_x + 10, jogador_y - 10, 20, 20) | ||
fill(0) | ||
ellipse(mouse_x - 10, jogador_y - 10, 10, 10) | ||
ellipse(mouse_x + 10, jogador_y - 10, 10, 10) | ||
fill(255) | ||
ellipse(mouse_x - 12, jogador_y - 12, 5, 5) | ||
ellipse(mouse_x + 12, jogador_y - 12, 5, 5) | ||
|
||
# Boca | ||
fill(0) | ||
ellipse(mouse_x, jogador_y + 15, 15, 10) | ||
fill(178, 200, 145) | ||
ellipse(mouse_x, jogador_y + 20, 10, 10) | ||
|
||
def desenhar_jogador(): | ||
|
||
global jogador_y, seguro, pontos, nivel | ||
|
||
jogador_y = int(height * 0.8) | ||
|
||
colide = get(mouse_x, jogador_y).hex | ||
colide2 = get(mouse_x, jogador_y + 30).hex | ||
colide3 = get(mouse_x + 30, jogador_y).hex | ||
colide4 = get(mouse_x, jogador_y - 30).hex | ||
|
||
if mouse_x < width: # à esquerda da tela | ||
colide2 = seguro.hex | ||
|
||
if mouse_x > width: # à direita da tela | ||
colide3 = seguro.hex | ||
|
||
#print(colide, colide2, colide3, colide4) | ||
|
||
if colide == seguro.hex and colide2 == seguro.hex and colide3 == seguro.hex and colide4 == seguro.hex: | ||
jogador_seguro() | ||
pontos += nivel | ||
else: # Colidiu | ||
jogador_colidido() | ||
nivel = 0 | ||
|
||
def desenhar_obstaculos(): | ||
global nivel | ||
|
||
seed(41143644) | ||
|
||
if frame_count & height == height - 1 and nivel < 5: | ||
nivel += 1 | ||
print('Você atingiu o nível', nivel) | ||
|
||
for i in range(9 + nivel): | ||
ob_x = randint(0, width) | ||
ob_y = randint(0, height) + frame_count | ||
ob_y %= height | ||
text('🦠', ob_x, ob_y) | ||
|
||
def setup(): | ||
# Coloque aqui o código para ser executado uma vez | ||
size(400, 400) # largura e altura | ||
no_stroke() | ||
text_size(40) | ||
text_align(CENTER, TOP) | ||
|
||
def draw(): | ||
# Coloque aqui o código para ser executado em cada quadro | ||
global seguro, pontos, nivel | ||
|
||
seguro = Color(149, 161, 195) | ||
|
||
if nivel > 0: | ||
background(seguro) | ||
fill(145, 134, 126) | ||
text('Pontos: ' + str(pontos), width/2, 20) | ||
desenhar_obstaculos() | ||
desenhar_jogador() | ||
|
||
# Mantenha isto para executar seu código | ||
run() |
3 changes: 3 additions & 0 deletions
3
pt-BR/code/dont_collide_avoid_germs_example/project_config.yml
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Não colida: Evite os germes" | ||
identifier: "avoid-germs-example" | ||
type: 'python' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/python3 | ||
|
||
# Importar código da biblioteca | ||
from p5 import * | ||
from random import randint, seed | ||
|
||
nivel = 1 | ||
pontos = 0 | ||
|
||
# A função desenhar_obstáculo vai aqui | ||
def desenhar_obstaculos(): | ||
global nivel | ||
|
||
seed(123456789) | ||
|
||
if frame_count % width == width - 1 e nivel < 10: | ||
nivel += 1 | ||
print('Você atingiu o nível', nivel) | ||
|
||
for i in range (6 + nível): | ||
ob_x = randint(0, width) - (frame_count * nivel) | ||
ob_x = randint(0, height) | ||
ob_x %= width # Envolve toda a largura | ||
text('💩', ob_x, ob_y) | ||
|
||
# A função desenhar_jogador vai aqui | ||
def desenhar_jogador(): | ||
global pontos, nivel | ||
|
||
jogador_x = int(width * 0.2) | ||
jogador_y = mouse_y | ||
|
||
colide = get(jogador_x + 50, jogador_y + 15).hex | ||
colide2 = get(jogador_x + 50, jogador_y - 15).hex | ||
colide3 = get(jogador_x, jogador_y + 15).hex | ||
colide4 = get(jogador_x, jogador_y - 15).hex | ||
colide5 = get(jogador_x - 50, jogador_y + 15).hex | ||
colide6 = get(jogador_x - 50, jogador_y - 15).hex | ||
|
||
if jogador_y > height - 18: # Fora da parte inferior da tela | ||
colide = seguro.hex | ||
colide3 = seguro.hex | ||
colide5 = seguro.hex | ||
|
||
if jogador_y < 18: # Fora da parte superior da tela | ||
colide2 = seguro.hex | ||
colide4 = seguro.hex | ||
colide6 = seguro.hex | ||
|
||
if colide == seguro.hex and colide2 == seguro.hex and colide3 == seguro.hex and colide4 == seguro.hex: | ||
image(carro, jogador_x, jogador_y, 100, 31) | ||
pontos += nivel | ||
else: | ||
text('💥', jogador_x, jogador_y) | ||
nivel = 0 | ||
|
||
|
||
def setup(): | ||
# Configure sua animação aqui | ||
size(400, 400) | ||
global carro | ||
carro = load_image('car.png') | ||
image_mode(CENTER) | ||
|
||
|
||
def draw(): | ||
# Coisas para fazer em cada quadro | ||
global pontos, seguro, nivel | ||
seguro = Color(128) | ||
|
||
if nivel > 0: | ||
background(seguro) | ||
fill(255) | ||
text_size(16) | ||
text_align(RIGHT, TOP) | ||
text('Pontos', width * 0.45, 10, width * 0.5, 20) | ||
text(str(pontos), width * 0.45, 25, width * 0.5, 20) | ||
text_size(20) | ||
text_align(CENTER, TOP) # posição em torno do centro, topo | ||
desenhar_obstaculos() | ||
desenhar_jogador() | ||
|
||
run() |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: "Não Colida: Carro Limpo" | ||
identifier: "clean-car-example" | ||
type: "python" | ||
|
||
|
127 changes: 127 additions & 0 deletions
127
pt-BR/code/dont_collide_dodge_asteroids_example/main.py
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 |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#!/bin/python3 | ||
|
||
# Importar código da biblioteca | ||
from p5 import * | ||
from random import randint, seed | ||
|
||
nivel = 1 | ||
pontos = 0 | ||
vidas = 3 | ||
invun = 0 | ||
|
||
# A função desenhar_obstáculo vai aqui | ||
def desenhar_obstaculos(): | ||
global nivel | ||
|
||
seed(random_seed) | ||
|
||
if frame_count % height == height - 1 and nivel < 8: | ||
nivel += 1 | ||
print('Você atingiu o nível', nivel) | ||
|
||
for i in range (6 + nível): | ||
ob_x = randint(0, width) | ||
ob_y = randint(0, height) + (frame_count * nivel) | ||
ob_x %= height # Envolve toda a altura | ||
push_matrix() | ||
translate(ob_x, ob_y) | ||
rotate(degrees(randint(1, 359)+frame_count / 1000)) | ||
image(rocha, 0, 0, randint(18,24), randint(18,24)) | ||
pop_matrix() | ||
|
||
|
||
# A função desenhar_jogador vai aqui | ||
def desenhar_jogador(): | ||
global pontos, nivel, vidas, invun | ||
|
||
jogador_y = int(height * 0.8) | ||
jogador_x = mouse_x | ||
|
||
colide = get(jogador_x +, jogador_y).hex | ||
colide2 = get(jogador_x - 18, jogador_y + 17).hex | ||
colide3 = get(jogador_x + 18, jogador_y + 17).hex | ||
colide4 = get(jogador_x, jogador_y + 25).hex | ||
|
||
if jogador_x < width: # fora do lado esquerdo da tela | ||
colide2 = seguro.hex | ||
|
||
if jogador_x > width: # fora do lado direito da tela | ||
colide3 = seguro.hex | ||
|
||
if (colide == seguro.hex and colide2 == seguro.hex and colide3 == seguro.hex and colide4 == seguro.hex) or invun > 0: | ||
if vidas == 0 and frame_count % 12 == 0: | ||
tint(200, 0, 0) | ||
|
||
image(foguete, jogador_x, jogador_y + 25, 64, 64) | ||
pontos += nivel | ||
invun -= 1 | ||
no_tint() | ||
|
||
if invun > 0: | ||
stroke(220) | ||
fill(220, 220, 220, 60) | ||
ellipse(jogador_x, jogador_y + 18, 47, 47) | ||
|
||
elif vidas > 1: | ||
vidas -= 1 | ||
invun = 50 | ||
tint(200, 0, 0) | ||
image(foguete, jogador_x, jogador_y + 25, 64, 64) | ||
no_tint() | ||
pontos += nivel | ||
else: | ||
text('💥', jogador_x + 10, jogador_y + 5) | ||
nivel = 0 | ||
|
||
|
||
def exibir_pontos(): | ||
global nivel | ||
|
||
fill(255) | ||
text_size(16) | ||
text_align(RIGHT, TOP) | ||
text('Pontos', width * 0.45, 10, width * 0.5, 20) | ||
text(str(pontos), width * 0.45, 25, width * 0.5, 20) | ||
|
||
if pontos > 10000: | ||
nivel = 0 | ||
print('🎉🎉 Você venceu! 🎉🎉') | ||
|
||
|
||
def exibir_vidas(): | ||
fill(255) | ||
text_size(16) | ||
text_align(LEFT, TOP) | ||
text('Vidas', width * 0.05, 10, 30, 20) | ||
|
||
for i in range(vidas): | ||
image(foguete, width * 0.05 + i * 25, 40, 20, 20) | ||
|
||
|
||
def setup(): | ||
# Configure sua animação aqui | ||
size(400, 400) | ||
global foguete, rocha, semente_aleatoria | ||
|
||
text_size(40) | ||
text_align(CENTER, TOP) # posição em torno do centro, topo | ||
|
||
rocket = load_image('rocket.png') | ||
rock = load_image('moon.png') | ||
random_seed = randint(0, 1000000) | ||
|
||
def draw(): | ||
# Coisas para fazer em cada quadro | ||
global pontos, seguro, nivel | ||
seguro = Color(0) | ||
|
||
if nivel > 0: | ||
background(seguro) | ||
fill(255) | ||
image_mode(CENTER) | ||
desenhar_obstaculos() | ||
desenhar_jogador() | ||
exibir_pontos() | ||
exibir_vidas() | ||
|
||
run() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
pt-BR/code/dont_collide_dodge_asteroids_example/project_config.yml
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Não Colida: Desvie de Asteroides" | ||
identifier: "dodge-asteroids-example" | ||
type: "python" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.