# NYXWorld Low cortisol simple **Archetype** **ECS** # Examples **Basic** ```zig const Exclude = struct {}; const Zombie = struct {}; const Player = struct { name: []const u8 }; const Vehicle = struct {}; const Transform = struct { pos: @Vector(2, f32) = .{ 0, 0 }, scale: @Vector(2, f32) = .{ 32, 32 } }; const Velocity = struct { value: @Vector(2, f32) = .{ 0, 0 } }; test "basic" { // --- WORLD --- var world: World = .init(std.testing.allocator); defer world.deinit(); // --- PLAYER --- try world.spawn(.{ Player{ .name = "abux" }, Transform{}, Velocity{}, }); // --- QUERY --- var it = world.query(struct { player: ?*const Player, zombie: ?*const Zombie, vehicle: ?*const Velocity, transform: *Transform, velocity: *Velocity, }, .{ .without = &.{ Exclude, }, }); while (it.next()) |e| { // --- MOVE --- e.velocity.value[0] += 2; e.velocity.value[1] += 4; // --- APPLY VELOCITY --- e.transform.pos[0] += e.velocity.value[0]; e.transform.pos[1] += e.velocity.value[1]; // --- DEBUG PLAYER --- if (e.player) |player| { std.debug.print( \\({f})PLAYER \\| Name: {s} \\| Position: {} \\| Scale: {} \\ , .{ it.entity(), player.name, e.transform.pos, e.transform.scale, }); } } } ``` **Output** ```text (1) PLAYER | Name: abux | Position: { 2, 4 } | Scale: { 32, 32 } ```