3D World (block games)
How to make 3D block games: world editor, custom pieces, player, target, inventory and 3D bodies.
The 3D world editor
- Add the 3D World extension (Premium) and click Open the 3D world editor.
- Generate terrain (hills, mountains, island, desert, snow, caves) or start empty.
- Tools: place, erase, paint, eyedropper, filled and hollow box, layer, sphere and start point. Y layer shows only up to a height.
- Right button orbits, Shift + right pans, the wheel zooms. Ctrl+Z undoes.
- In the Pieces tab, draw 16 x 16 blocks (top, sides, bottom) with type, hardness and drops.
Playing
- player controls turns on W A S D, space and the mouse (click the stage; Esc releases).
- The target points at the block in the center: use is a block targeted?, crack, break and place in front of the target.
- show hotbar / hearts / crosshair / hand builds the game screen; 1 to 9 and the wheel choose the item.
- Sprites get a 3D body (zombie, pig, sheep…) and move with walk towards the player, run away and wander. Sprites without a 3D body appear on top, like a HUD.
See the example Craft 3D: mine and build.
Blocks to get started
• evt_bandeira • m3d_gerar [TIPO: colinas, SEMENTE: 7] • m3d_camera [MODO: primeira] • m3d_controles [MODO: sim] • m3d_toque [MODO: auto] • m3d_hud [QUAL: barra, MODO: sim] • m3d_hud [QUAL: vida, MODO: sim]
Phone: on-screen controls
- On phones and tablets, Minecraft-like buttons appear: arrows (walk), middle button (sneak, or fly down) and jump. Drag the screen to look, tap to place/use and hold to break/hit.
- The on-screen touch controls block chooses: automatic (phones only), always or never.
Inventory (36 slots)
- Key E (or the … button next to the hotbar) opens the inventory: 27 storage slots + the 9-slot hotbar.
- Click picks up and drops, right click splits the stack, Shift + click moves between hotbar and inventory. The inventory: open/close and inventory open? blocks control it from code.
• evt_tecla [TECLA: i] • ctl_se_senao [COND: (m3d_inv_aberto)] • m3d_inv_abrir [MODO: nao] …: • m3d_inv_abrir [MODO: sim]
Coins and enemies (clones with a 3D body)
• ctl_quando_clone
• m3d_corpo [FORMA: esfera, COR: #F2C230, TAM: 45]
• m3d_corpo_perto [DIST: 8]
• ctl_sempre
• m3d_corpo_girar [GRAUS: 8]
• ctl_se [COND: (m3d_corpo_estado)]
• ctl_apagar_clone• ctl_quando_clone
• m3d_corpo [FORMA: modelo, TAM: 100]
• m3d_corpo_anim_auto [PARADO: parado, ANDANDO: andar]
• ctl_sempre
• ctl_se_senao [COND: (m3d_corpo_estado)]
• m3d_corpo_seguir [VEL: 2]
…:
• m3d_corpo_passear [VEL: 0.8]
• m3d_quando_clicar [BOTAO: esquerdo]
• ctl_se [COND: (m3d_corpo_estado)]
• m3d_corpo_vida_mudar [V: -4]
• m3d_corpo_piscarNew 3D examples
- 3D coin hunt (easy): the simplest one to start with. Open
- 3D parkour with characters (medium): platforms over lava, checkpoints and animated 3D characters. Open
- 3D Dungeon: retro shooter (hard): an original first-person shooter in 90s style, with a brick maze, 3D robots and aliens, ammo and health kits. Open
Several 3D backdrops (one world per backdrop)
- Each backdrop of the stage can have its own 3D world, so a game can have several 3D levels.
- In the Backdrops tab (with the Stage selected), the "3D World" button creates a 3D backdrop; 3D backdrops get the 3D badge and an "Edit in the 3D world editor" button.
- Switching backdrop (the "switch backdrop to ..." block) loads that backdrop's 3D world. A 2D backdrop hides the 3D one.
A menu button that starts the game (no flag)
- Clicking a sprite that has "when this sprite clicked" already starts the game — no green flag needed. Make a Menu backdrop (2D) with a "Play" button that uses "switch backdrop to" to go to the 3D level.
• evt_clicado • apa_cenario [CENARIO: Fase1] • apa_esconder • evt_cenario_muda [CENARIO: Fase1] • m3d_camera [MODO: terceira] • m3d_jog_aparencia
Macro editor (generate scenery by repetition)
- In the 3D world editor, the "Macros (blocks)" tab is a block editor to build scenery with repetition: "fill", "filled/hollow box", "sphere", "column", "repeat N times", "for i from … to …", values and "world size". Click "Run macro" to generate (undoable).
3D characters from a file (.glb) in the game
- A sprite with a 3D character (modelo3d, from the generator OR a .glb file) shows in 3D in the world. In "player appearance" and the 3D World menus it is marked with (3D).
- See the "3D Hero Adventure" example (menu + 3D backdrop + file character). Open