mooball
v0.1.0
Published
The official node.js API for mooball.
Downloads
9
Readme
- Here is the Github repository for this project.
- Detailed documentation is here.
- We are also inviting you to our discord server. See you there!
🔖 Table Of Contents
💻 Installing & importing as a node.js/CommonJS module:
npm install mooballconst { 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.💻 Usage on Browser
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js"></script> <!-- json5 library -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/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>💻 Example code using the library:
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);
};
}
});- Make a fork of this repository
- Clone to you machine and entry on respective paste
- Create a branch with your resource:
git checkout -b my-feature - Commit your changes:
git commit -m 'feat: My new feature' - Push your branch:
git push origin my-feature - A green button will appear at the beginning of this repository
- Click to open and fill in the pull request information
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. :)
