VIBEGAMES
ALPHA
My ProjectsMy Games
Getting Started

Scripting OverviewAPI Reference
Scripting

API Reference

Complete scripting API reference.

Objects API

Access scene objects through ctx.objects:

Finding Objects

const obj = ctx.objects.getById("some-id");
const obj = ctx.objects.getByName("Player");
const enemies = ctx.objects.findBy((o) => o.name.startsWith("Enemy"));
const first = ctx.objects.findFirst((o) => o.type === "box");
const all = ctx.objects.getAll();

Querying Objects

Use MongoDB-style queries for advanced filtering:

const boxes = ctx.objects.query({ type: "box" });
const first = ctx.objects.queryFirst({ name: "Player" });
const count = ctx.objects.count();

Modifying Objects

ctx.objects.add(newObject);
ctx.objects.remove(id);
ctx.objects.move(id, newParentId);
ctx.objects.duplicate(id, parentId);

Input

Keyboard

export function update(ctx) {
  if (ctx.input.keys.has("KeyW")) {
    // Move forward
  }
  if (ctx.input.keys.has("Space")) {
    // Jump
  }
}

Mouse

export function update(ctx) {
  const { x, y } = ctx.input.mousePosition;

  if (ctx.input.mouseButtons.has(0)) {
    // Left click held
  }
}

Time

export function update(ctx) {
  // Frame-rate independent movement
  const speed = 5;
  ctx.entity.position.x += speed * ctx.time.delta;

  // Time since game started
  console.log(ctx.time.elapsed);
}

Variables

Project-wide variables accessible from any script:

// Read
const score = ctx.variables.score;

// Write
ctx.variables.score = 100;

// Watch changes
ctx.watchKey(ctx.variables, "score", (value) => {
  console.log("New score:", value);
});

Messages

// Send a message
ctx.send("game:over", { winner: "player1" });

// Receive messages
export function onMessage(ctx, message) {
  if (message.type === "game:over") {
    console.log(message.payload.winner);
  }
}

Entity

The object this script is attached to:

export function update(ctx) {
  // Access transform
  ctx.entity.position.x += 1 * ctx.time.delta;
  ctx.entity.rotation.y += 0.5 * ctx.time.delta;
  ctx.entity.scale.x = 2;
}

Scripting Overview

How scripting works in Vibe Games.

Publishing & Sharing

How to publish and share your games.

On this page

Objects APIFinding ObjectsQuerying ObjectsModifying ObjectsInputKeyboardMouseTimeVariablesMessagesEntity

Vibe Games

© 2026 Vibe Games. All rights reserved.

Quick Links

  • Browse Games
  • Create Game
  • Documentation

Community

  • GitHub

Legal

  • Privacy Policy
  • Terms of Service