Blocos
Blocks
Cada objeto pode ter uma pilha de blocos. Eventos abrem um bloco de ações e são fechados com "Fim do evento"; você pode aninhar blocos arrastando pelo pino à esquerda. O botão Converter em Lua transforma a pilha em código equivalente.
Each object can have a stack of blocks. Events open a block of actions and are closed with "End event"; you can nest blocks by dragging the grip on the left. The Convert to Lua button turns the stack into equivalent code.
Eventos
Events
| Bloco | Block | Quando roda | When it runs |
| Quando iniciar | On start | Uma vez, ao executar. | Once, when the game starts. |
| Enquanto tecla {s} | While key {s} | A cada quadro, se a tecla estiver pressionada. Teclas: esquerda, direita, cima, baixo. | Every frame, while the key is held. Keys: esquerda, direita, cima, baixo. |
| Quando colidirem com {s} | On collide with {s} | Quando passa a tocar o objeto com aquele nome (dispara uma vez). | When it starts touching the object with that name (fires once). |
| Quando o tilemap colidir | On tilemap collide | Quando passa a tocar o chão/tilemap. | When it starts touching the ground/tilemap. |
Timer
Timer
| Bloco | Block | Para que serve | What it does |
| A cada {} segundos | Every {} seconds | Repete as ações no intervalo em segundos. | Repeats the actions on the given interval in seconds. |
Condições
Conditions
| Bloco | Block | Para que serve | What it does |
| Se a condição {} | If condition {} | Roda as ações se a expressão for verdadeira. Use variáveis pelo nome, ex.: pontos > 10. | Runs the actions if the expression is true. Use variable names directly, e.g. pontos > 10. |
| Se não for verdadeira | Else | Roda as ações quando a condição acima for falsa. | Runs the actions when the condition above is false. |
Nas expressões, Math.floor, Math.random, etc. são traduzidos para Lua automaticamente na conversão.
In expressions, Math.floor, Math.random, etc. are translated to Lua automatically on conversion.
Sprite
Sprite
| Bloco | Block | Lua |
| Definir Posição X {} Y {} | Set position | definir_posicao(x, y) |
| Mover X {} Y {} | Move | mover(dx, dy) |
| Definir imagem {s} | Set image | definir_imagem("a.png") |
| Definir largura {} / altura {} | Set width / height | definir_largura(w) / definir_altura(h) |
| Definir cor {s} | Set color | definir_cor("#fff") |
| Remover objeto | Remove object | remover() |
Física
Physics
| Bloco | Block | Lua |
| Pular força {} | Jump force {} | pular(f) |
| Definir velocidade Y {} | Set Y velocity {} | velocidade_y(v) |
Objetos sem Static sofrem gravidade. Objetos com Sólido e as células de tilemap viram chão sólido. Use "Remover objeto" para fazer uma moeda sumir ao colidir com o jogador.
Objects without Static fall under gravity. Objects with Solid and tilemap cells become solid ground. Use "Remove object" to make a coin vanish when it hits the player.
Variáveis
Variables
| Bloco | Block | Lua |
| Definir variável {s} como {} | Set variable | definir_var("pontos", 0) |
| Somar à variável {s} valor {} | Add to variable | definir_var("pontos", var("pontos") + 1) |
Textos
Text
| Bloco | Block | Lua |
| Mostrar texto {s} | Show text | mostrar_texto("Pontos: {pontos}") |
Use {nome} para inserir o valor de uma variável no texto.
Use {name} to insert a variable value into the text.
Animações
Animations
| Bloco | Block | Lua |
| Tocar animação {s} | Play animation | tocar("nome") |
| Parar animação | Stop animation | parar() |
| Espelhar imagem {} | Flip image | espelhar(true) |
Áudio
Audio
| Bloco | Block | Lua |
| Tocar som {s} | Play sound | tocar_som("moeda.wav") |
| Tocar música {s} | Play music | tocar_musica("tema.ogg") |
| Parar sons | Stop sounds | parar_som() / parar_musica() |
Câmera
Camera
| Bloco | Block | Lua |
| Seguir objeto {s} | Follow object {s} | seguir("heroi") |
| Definir câmera X {} Y {} | Set camera X {} Y {} | camera(x, y) |
Jogo
Game
| Bloco | Block | Lua |
| Salvar jogo | Save game | salvar_jogo() |
| Carregar jogo | Load game | carregar_jogo() |