Skip to main content

Scripting

Scripts are the heart of interactivity in OasisW. They are reusable pieces of code that you attach to entities to define behavior, handle user input, manage game logic, and bring life to your project.

Scripting Systems

OasisW supports the following 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 to Learn

Fundamentals

Core concepts that apply to all OasisW scripts: