VisualJava
Online Editor only

Online Editor Wiki

This wiki covers only the browser-based block editor โ€” how to use the interface, and what every block does with a code example. For the JVL language and the desktop app in general, see the main Wiki.

01 The interface

The Online Editor has four areas: the File menu (save all, reload, back to your dashboard), the file tree on the left, the scene / code tabs in the middle, and the console at the bottom, which prints anything logged with System.print or block execution errors while a project runs.

Tip

Every project is created with a locked default structure (main/jvl, resources/vj, resources/assets, project.yml) โ€” the same layout the desktop app expects, so a project you start here opens directly in Visual Java too.

01 L'interfaccia

L'Online Editor ha quattro aree: il menu File (salva tutto, ricarica, torna alla dashboard), l'albero dei file a sinistra, le tab scena/codice al centro e la console in basso, che stampa quello che logghi con System.print o gli errori di esecuzione mentre un progetto gira.

Suggerimento

Ogni progetto viene creato con una struttura di base bloccata (main/jvl, resources/vj, resources/assets, project.yml) โ€” lo stesso schema che si aspetta l'app desktop, cosi' un progetto iniziato qui si apre direttamente anche in Visual Java.

02 File tree & classes

Right-click a folder to create a new class (a .jvl file with its own blocks) or upload a file. Classes appear as ๐Ÿงฉ in the tree; opening one shows its blocks โ€” variables, methods, and the code inside each method.

IconMeaning
๐Ÿ“ / ๐Ÿ“‚Folder (locked folders are part of the required project structure)
๐ŸงฉA class โ€” has its own block workspace
โ—ˆA .vj file โ€” a sprite/object placed in the 2D scene
๐Ÿ–ผ / ๐Ÿ”ŠAn image or audio asset

02 Albero file & classi

Clicca col destro su una cartella per creare una nuova classe (un file .jvl con i suoi blocchi) o caricare un file. Le classi appaiono come ๐Ÿงฉ nell'albero; aprendone una vedi i suoi blocchi โ€” variabili, metodi e il codice dentro ogni metodo.

IconaSignificato
๐Ÿ“ / ๐Ÿ“‚Cartella (le cartelle bloccate fanno parte della struttura obbligatoria del progetto)
๐ŸงฉUna classe โ€” ha il suo spazio di lavoro a blocchi
โ—ˆUn file .vj โ€” uno sprite/oggetto posizionato nella scena 2D
๐Ÿ–ผ / ๐Ÿ”ŠUn asset immagine o audio

03 Run, Stop & saving

โ–ถ Run executes Main.main(): it fires every block tagged @onStart, then Main, and if any object listens for @onUpdate, @onClick or @onMouseMove it keeps listening for those until you press โน Stop. Files save automatically a moment after you stop editing (see the badge next to the project name); ๐Ÿ’พ Save all forces it immediately.

Project size limit

Every project has a maximum size (shown as an error in the save badge if exceeded). Large images are automatically resized/recompressed on upload to help stay under it โ€” see the community page for details on published projects.

03 Avvio, stop e salvataggio

โ–ถ Avvia esegue Main.main(): attiva ogni blocco taggato @onStart, poi Main, e se qualche oggetto ascolta @onUpdate, @onClick o @onMouseMove continua ad ascoltarli finche' non premi โน Ferma. I file si salvano automaticamente un istante dopo che smetti di modificare (vedi il badge accanto al nome del progetto); ๐Ÿ’พ Salva tutto forza il salvataggio subito.

Limite di peso progetto

Ogni progetto ha una dimensione massima (mostrata come errore nel badge di salvataggio se superata). Le immagini grandi vengono ridimensionate/ricompresse automaticamente al caricamento per restare sotto il limite.

04 Events

Event blocks sit at the top of a method and decide when its code runs. Drop one from the Events palette group onto a method.

04 Eventi

I blocchi evento stanno in cima a un metodo e decidono quando il suo codice viene eseguito. Trascinane uno dal gruppo Events della palette su un metodo.

BlockWhen it fires
@onStartOnce, right when Run begins (before Main)
@onUpdateEvery frame, for as long as the program keeps running
@onClickWhen the object is clicked in the running scene
@onMouseMoveWhenever the mouse moves over the scene
@onCloneOn a clone, right when it's created
Player.jvlblock โ†’ code
class Player {

    @onStart
    void init() {
        System.print("Player ready");
    }

    @onUpdate
    void tick() {
        if (isKeyPressed("RIGHT")) {
            move(4, 0);
        }
    }

}

05 Control flow

From the Control palette group: if / else, for ( ) times, while ( ), sleep ( ) ms and async (runs its contents without blocking the rest of the method).

05 Controllo di flusso

Dal gruppo Control della palette: if / else, for ( ) volte, while ( ), sleep ( ) ms e async (esegue il suo contenuto senza bloccare il resto del metodo).

Enemy.jvlblock โ†’ code
for (3 times) {
    System.print("Spawning...");
    sleep(500 ms);
}

if (getX() > 400) {
    setX(0);
} else {
    move(2, 0);
}

06 Variables & values

A class can hold Variable members (with an initial value), and methods can Get Variable / Set Variable on them. Value blocks int, string, tag and Boolean plug into any input slot that expects that type.

06 Variabili & valori

Una classe puo' avere membri Variable (con un valore iniziale), e i metodi possono fare Get Variable / Set Variable su di essi. I blocchi valore int, string, tag e Boolean si incastrano in qualsiasi slot che si aspetti quel tipo.

Score.jvlblock โ†’ code
class Score {

    int points = 0;

    void addPoint() {
        points = points + 1;
        System.print("Score: " + points);
    }

}

07 Math & logic

Math operator blocks: + โˆ’ * : % (: is division). Comparisons: = > < <= >=. Logic: and, or, not โ€” combine them to build any if or while condition.

07 Matematica & logica

Blocchi operatore matematico: + โˆ’ * : % (: รจ la divisione). Confronti: = > < <= >=. Logica: and, or, not โ€” combinali per costruire qualsiasi condizione if o while.

exampleblock โ†’ code
if (getX() > 100 && not isKeyPressed("SPACE")) {
    System.print("Far enough, and space isn't pressed");
}

08 Console & method calls

System.log( ) prints to the console at the bottom of the editor โ€” invaluable while testing. call invokes another method (on the same class or another one); mark it async to fire it without waiting for it to finish.

08 Console & chiamate a metodi

System.log( ) stampa nella console in basso nell'editor โ€” utilissimo mentre si testa. call invoca un altro metodo (della stessa classe o di un'altra); segnalo come async per lanciarlo senza aspettare che finisca.

exampleblock โ†’ code
System.log("Debug: entering room 2");
call Enemy.spawnWave(); // async

09 Sprites โ€” movement & position

These blocks act on the object the class is attached to (a .vj sprite in the scene): move (dx, dy), set pos (x, y), set x ( ), set y ( ), point towards (x, y), set rotation ( ).

09 Sprite โ€” movimento & posizione

Questi blocchi agiscono sull'oggetto a cui la classe e' collegata (uno sprite .vj nella scena): move (dx, dy), set pos (x, y), set x ( ), set y ( ), point towards (x, y), set rotation ( ).

Player.jvlblock โ†’ code
@onUpdate
void tick() {
    if (isKeyPressed("UP"))    move(0, -4);
    if (isKeyPressed("DOWN"))  move(0, 4);
    pointTowards(getMouseX(), getMouseY());
}

10 Sprites โ€” appearance

set texture ( ), set lightness ( ), set darkness ( ) and set transparency ( ) change how the sprite is drawn each frame โ€” handy for hit flashes, fades, or costume swaps.

10 Sprite โ€” aspetto

set texture ( ), set lightness ( ), set darkness ( ) e set transparency ( ) cambiano come lo sprite viene disegnato a ogni frame โ€” utili per flash da colpo, dissolvenze o cambi costume.

Enemy.jvlblock โ†’ code
void onHit() {
    setTransparency(120);
    sleep(150 ms);
    setTransparency(255);
}

11 Sensing & input

get x / get y / get direction read the sprite's own state; is touching ( ) checks collision against a tag. For input: get pressed key, is key pressed ( ), get mouse x/y, get date.

11 Sensing & input

get x / get y / get direction leggono lo stato dello sprite stesso; is touching ( ) controlla la collisione contro un tag. Per l'input: get pressed key, is key pressed ( ), get mouse x/y, get date.

Player.jvlblock โ†’ code
@onUpdate
void tick() {
    if (isTouching("enemy")) {
        System.print("Ouch!");
    }
}

12 Clones & tags

create clone ( ) spawns a copy of the current object (fires that clone's @onClone); kill clone removes it. add object to tag ( ) / remove object from tag ( ) manage groups used by is touching and other tag-based checks.

12 Cloni & tag

create clone ( ) crea una copia dell'oggetto corrente (attiva l'evento @onClone di quel clone); kill clone lo rimuove. add object to tag ( ) / remove object from tag ( ) gestiscono i gruppi usati da is touching e altri controlli basati sui tag.

Spawner.jvlblock โ†’ code
@onStart
void spawnWave() {
    for (5 times) {
        createClone();
        sleep(300 ms);
    }
}

@onClone
void setup() {
    addObjectToTag("enemy");
}