npm install mooball
const { OperationType, VariableType, ConnectionState, AllowFlags, Direction, CollisionFlags, CameraFollow, BackgroundType, GamePlayState, BanEntryType, Callback, Utils, Room, Replay, Query, Library, RoomConfig, Plugin, Renderer, Errors, Language, EventFactory, Impl } = require("mooball")();
// Use example code here.
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/json5@2.2.3/dist/index.min.js"></script> <!-- json5 library -->
<script src="https://cdn.jsdelivr.net/npm/pako@2.1.0/dist/pako.min.js"></script> <!-- pako library -->
<script src="https://cdn.jsdelivr.net/gh/wxyz-abcd/mooball@latest/src/api.js"></script> <!-- this file comes from this repo -->
</head>
<body>
<script>
var { OperationType, VariableType, ConnectionState, AllowFlags, Direction, CollisionFlags, CameraFollow, BackgroundType, GamePlayState, BanEntryType, Callback, Utils, Room, Replay, Query, Library, RoomConfig, Plugin, Renderer, Errors, Language, EventFactory, Impl } = poyoCoreAPI(window);
// You do not need a proxy server if you use browser's extension mechanism.
// Use example code here.
</script>
</body>
</html>
Joining a room:
Utils.generateAuth().then(([authKey, authObj])=>{
Room.join({
id: "ZzZzZzZzZzZzZzZzZz",
authObj: authObj
}, {
storage: {
player_name: "wxyz-abcd",
avatar: "👽"
},
onOpen: (room)=>{
room.sendChat("Hello " + room.name);
}
});
});
Creating a room:
Room.create({
name: "room123",
password: "password",
showInRoomList: true,
maxPlayerCount: 8,
token: "thr1.NS3Ah4d3as_h1aS1DH4FAh3aZsdAgD.01J_eSDruujs4dA"
}, {
storage: {
player_name: "wxyz-abcd",
avatar: "👽"
},
onOpen: (room)=>{
room.sendChat("Hello " + room.name);
room.onAfterRoomLink = (roomLink)=>{
console.log("room link:", roomLink);
};
}
});
git checkout -b my-featuregit commit -m 'feat: My new feature'git push origin my-feature
Contributions, issues and features requests are welcome!
📮 Submit PRs to help solve issues or add features
🐛 Find and report issues
🌟 Star the project
MIT License, all rights reserved. Copyright © 2022-2026 abc
We do not take any responsibility on potential harm caused by this code. Use at your own risk, and be creative. :)