GithubHelp home page GithubHelp logo

lajbel / newgrounds-boom Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 105 KB

๐ŸŽ–๏ธ Newgrounds.io Kaboom plugin

Home Page: https://npmjs.com/newgrounds-boom

JavaScript 70.31% TypeScript 29.69%

newgrounds-boom's Introduction

Kaboom x Newgrounds.io

With this Kaboom plugin you can use medals and post scores on Newgrounds.com

Quick example

import newgroundsPlugin from "newgrounds-boom";

kaboom({
    width: 500,
    height: 500,
    plugins: [ newgroundsPlugin ]
});

ngInit("52924:fdddr5yP", "oEZ7GGD79Wht9upZ4HH7Dw==", 1);
ngUnlockMedal(65025);

add([
    text("ohhi " + String(ngUsername()), {size: 40, width: 400}),
    origin("center"),
    pos(width() / 2, height() / 2)
]);

onKeyPress("space", () => {
    add([
        text(String(ngVersion()), {size: 30}),
        origin("center"),
        pos(width() / 2, height() - 80)
    ]);
});

onMouseDown(() => {
    ngUnlockMedal(65022);
    ngPostScore(10739, rand(0, 9999).toString());
});

How to use

Init

In your project, activate the "api tools" and you will see the following credentials

Before using the newgrounds features, you'll need to connect your game, use ngInit("App ID", "Encryption Key"). You can activate the debug mode, which will return the results by console (cool if you have not yet published your game), use ngInit("App ID", "Encryption Key", 1);

Using the credentials of this game, it would be like this:

ngInit("52924:fdddr5yP", "oEZ7GGD79Wht9upZ4HH7Dw==");

Unlock Medals

Once you have done the previous step, you can use the scores and medals. Let's see the medals, for that you must first have a medal, duh

We will use the ngUnlockMedal("Medal ID in Number") function

ngUnlockMedal(65022);

Post Scores

Now, to use the scoreboards, again, we have to have a scoreboard duh

We will use the ngPostScore("Board ID in Number", "score") function

ngPostScore(10739, 1234);

Use global types

If you want to load the global types for use as other global Kaboom Functions, you can import from "load"

import "newgrounds-boom/global";

Other functions

ngUsername(): returns a String with the newgrounds username of the player
ngVersion(): returns a Number with the version of the newgrounds app
ngIsSupporter(): returns a Boolean with the status of newgrounds Support player

Install

  • NPM: npm i newgrounds-boom
  • CDN: jsdelivr or unpkg
  • Kaboom-Util: npm i kaboom-util -> import { newgroundsPlugin } from "kaboom-util";

newgrounds-boom's People

Contributors

lajbel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jdiperla

newgrounds-boom's Issues

Using ngInit() gives an error message.

The error message I get:

ERROR: Cannot read properties of undefined (reading 'enc')
-> node_modules/newgrounds-boom/src/newgrounds.js:92:38
-> node_modules/newgrounds-boom/src/newgrounds.js:65:25
-> node_modules/newgrounds-boom/src/newgrounds.js:11:37
-> code/main.js:20:0

code/main.js:20:0 is where I use ngInit().
I did add plugins: [ newgroundsPlugin ] inside kaboom(). And the order of appId, encKey is correct. But I still get the error message.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.