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
fn main() { | |
println!("Hello, world!"); | |
} |
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
print("Hello, world!") |
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
# Movimenta a bola no eixo X | |
bola.setx(bola.xcor() + bola.passos_x) | |
# Movimenta a bola no eixo Y | |
bola.sety(bola.ycor() + bola.passos_y) |
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
# Propriedade com o tamanho do passo no eixo X | |
bola.passos_x = 2 | |
# Propriedade com o tamanho do passo no eixo Y | |
bola.passos_y = 2 |
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
# Cria a bola | |
bola = turtle.Turtle() | |
# Define a forma | |
bola.shape('square') | |
# Define a cor | |
bola.color('white') | |
# Evita o problema de o usuário perceber a animação | |
bola.speed(0) | |
# Para que não desenhe rastro quando movimentar | |
bola.penup() |
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
def cria_player(posicao_x): | |
# Cria o objeto para o Player | |
player = turtle.Turtle() | |
# Define a forma | |
player.shape('square') | |
# Define a cor | |
player.color('white') | |
# Define o tamanho | |
player.shapesize(stretch_wid=5, stretch_len=1) | |
# Levanta a caneta, pois os objetos são criados na posição 0,0 |
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
# Cria o objeto para o Player A | |
player_a = turtle.Turtle() | |
# Define a forma | |
player_a.shape('square') | |
# Define a cor | |
player_a.color('white') | |
# Define o tamanho | |
player_a.shapesize(stretch_wid=5, stretch_len=1) | |
# Levanta a caneta, pois os objetos são criados na posição 0,0 | |
# se não fizer isso pinta uma linha branca do centro da tela |
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
# Importa a biblioteca | |
import turtle | |
# Cria a janela | |
janela = turtle.Screen() | |
# Define o título | |
janela.title('Pong') | |
# Define a cor de fundo | |
janela.bgcolor('black') | |
# Define o tamanho |
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
# Game loop | |
while True: | |
janela.update() |
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
# Importa a biblioteca | |
import turtle | |
# Cria a janela | |
janela = turtle.Screen() | |
# Define o título | |
janela.title('Pong') | |
# Define a cor de fundo | |
janela.bgcolor('black') | |
# Define o tamanho |
NewerOlder