Cocos Creator

Using Playroom with Cocos Creator

Cocos Creator (opens in a new tab) is a 2D/3D game engine that supports JavaScript and TypeScript. You can use Playroom with Cocos Creator to build multiplayer games.

Setup

Follow these steps to import Playroom into your project.

  • Now you can start using Playroom in your Cocos Creator scripts like this:
import * as PlayroomType from './playroom.d.ts';
const Playroom: typeof PlayroomType = window.Playroom;
 
export class MyScript extends Component {
 
    async start() {       
        await Playroom.insertCoin({
            // any options here
        });
    }
}