Skip to content

wxyz-abcd/mooball

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub package.json version NPM Version NPM Monthly Downloads WebServer Status

License Last Commit Language Most Used Repository Size

Forks Stars Watches

mooball

The official API for MooBall.

  • 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


🤔 How To Use

💻 Installing & importing as a node.js/CommonJS module:

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.

💻 Usage on Browser

<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>

💻 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);
    };
  }
});

💡 How To Contribute

  • 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

Contributions, issues and features requests are welcome!
📮 Submit PRs to help solve issues or add features
🐛 Find and report issues
🌟 Star the project

Back To The Top


🤗 Contributors

- Lots of testing and various plugins by JerryOldson
- Lots of testing and various plugins by mtkcnl (0x00)
- Lots of testing and renderer improvement by Dfg
- joystick plugin improved by jafkc2
We will continue to add all contributors to this list.

Back To The Top


🔏 License

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. :)

Back To The Top

About

The official repository for mooball

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors