Skip to main content

Scripting

Scripts are the heart of interactivity in OasisW. They're reusable pieces of code that you attach to Entities to define behaviors, handle user input, manage game logic, and bring your projects to life.

Scripting Systems

OasisW supports scripting approaches:

  • Classic Scripts (.js files) - The original OasisW scripting system using prototype-based syntax.

Quick Example

Here's a simple script that rotates an entity:

var Rotate = pc.createScript('rotate');

Rotate.attributes.add('speed', { type: 'number', default: 10 });

Rotate.prototype.update = function(dt) {
this.entity.rotate(0, this.speed * dt, 0);
};

What You'll Learn

Fundamentals

Core concepts that apply to all OasisW scripts: