Quick Start
This guide walks you through creating a simple game with labelle.
Create a Project
Section titled “Create a Project”labelle init my-first-gamecd my-first-gameDefine a Scene
Section titled “Define a Scene”Edit scenes/main.zon:
.{ .name = "main", .entities = .{ .{ .id = "player", .components = .{ .Position = .{ .x = 400, .y = 300 }, .Sprite = .{ .name = "player.png", .pivot = .center }, }, }, .{ .components = .{ .Position = .{ .x = 200, .y = 200 }, .Shape = .{ .type = .circle, .radius = 25, .color = .{ .r = 255 } }, }, }, },}Add a Script
Section titled “Add a Script”Create scripts/movement.zig:
const engine = @import("labelle-engine");
pub fn update(game: *engine.Game, scene: *engine.Scene, dt: f32) void { const input = game.getInput();
if (scene.getEntityByName("player")) |player| { var pos = game.getPosition(player); const speed: f32 = 200;
if (input.isKeyDown(.w)) pos.y -= speed * dt; if (input.isKeyDown(.s)) pos.y += speed * dt; if (input.isKeyDown(.a)) pos.x -= speed * dt; if (input.isKeyDown(.d)) pos.x += speed * dt;
game.setPosition(player, pos.x, pos.y); }}Enable the Script
Section titled “Enable the Script”Update scenes/main.zon to include the script:
.{ .name = "main", .scripts = .{"movement"}, .entities = .{ // ... entities },}Run the Game
Section titled “Run the Game”labelle runUse WASD to move the player around.
Next Steps
Section titled “Next Steps”- Project Structure - Learn about file organization
- Scenes & Entities - Deep dive into scenes
- Prefabs - Create reusable entity templates