1.0.8 • Published 3 months ago

dashifyjs v1.0.8

Weekly downloads
-
License
AGPL-3.0
Repository
-
Last release
3 months ago

DashifyJS

Ever wanted to convert JS/TS code into a geometry dash level? Now you can with DashifyJS!

Examples

This is also compatible with 2.2!

Typescript example

import dashifyjs, { Gamemode, PlayerSize, GameType } from "dashifyjs" // Importing the main scripts

dashifyjs.level.createLevel("DashifyJS", "Created by an npm module 'DashifyJS' This is a showcase to the package."); // Creating a level, with a name and description;
dashifyjs.level.setOfficialSong(4);
dashifyjs.level.Data.setFolder(0);

dashifyjs.level.setBGColor(1, 255, 9);
dashifyjs.level.setGroundColor(35, 99, 100);

dashifyjs.level.Data.setGameType(GameType.Normal); // Can be platformer too
dashifyjs.level.Data.setGamemode(Gamemode.Cube); // Changing the Gamemode setting to a 'Cube' or identified as a 0.
dashifyjs.level.Data.setPlayerSize(PlayerSize.Normal); // Can be Mini, or Normal.
dashifyjs.level.Data.setFont(3); // Font Identifier (ID)
dashifyjs.level.Data.setGNTexture(2); // Ground Texture
dashifyjs.level.Data.setBGTexture(5); // Background Texture

dashifyjs.triggers.createSpawn({ touchTrigger: true, target: 2, posX: 47, posY: 2, scale: 5 });
dashifyjs.triggers.createToggle({ posX: -100, posY: 1, target: 1, toggle: 0 });
dashifyjs.triggers.createReverse({ spawnTrigger: true, groupID: 2, posX: 47, posY: 10 });
dashifyjs.triggers.createToggle({ spawnTrigger: true, groupID: 2, posX: 47, posY: 10, target: 1, toggle: 1 });
dashifyjs.triggers.createEnd({ scale: 5, groupID: 1, posX: 1, posY: 1, touchTrigger: true });

dashifyjs.spikes.create("spike", { posX: 3, posY: 1 });
for (let i = 0; i < 20; i++) {
    if (i % 6 == 0) dashifyjs.triggers.createPulse({
        posX: (4 + i) + (i + 1) + 3,
        posY: 1,
        color: { r: 35, g: 99, b: 10 },
        channel: 1000
    });
    dashifyjs.blocks.create("cube", { posX: 4 + i + (i + 1), posY: 1 });
    dashifyjs.blocks.create("cube", { posX: 4 + i + (i + 1), posY: 10 });

    dashifyjs.spikes.create("spike", { posX: 4 + i + (i + 1), posY: 3 });
    dashifyjs.spikes.create("spike", { posX: 4 + i + (i + 1), posY: 8, flipY: true });
}

dashifyjs.portals.create("ship", { posX: 4, posY: 5 });
dashifyjs.specials.createText({ posX: 47, posY: 5, text: "DashifyJS" });

dashifyjs.Compiler.compile(); // Compile our code into a Geometry dash level.

Javascript Example

const dashifyjs = require("dashifyjs").default;
const { Gamemode, PlayerSize, GameType } = require("dashifyjs");

dashifyjs.level.createLevel("DashifyJS", "Created by an npm module 'DashifyJS' This is a showcase to the package.");
dashifyjs.level.setOfficialSong(4);
dashifyjs.level.Data.setFolder(0);

dashifyjs.level.setBGColor(1, 255, 9);
dashifyjs.level.setGroundColor(35, 99, 100);

dashifyjs.level.Data.setGamemode(Gamemode.Cube);
dashifyjs.level.Data.setPlayerSize(PlayerSize.Normal);
dashifyjs.level.Data.setGameType(GameType.Normal);
dashifyjs.level.Data.setFont(3);
dashifyjs.level.Data.setGNTexture(2);
dashifyjs.level.Data.setBGTexture(5);

dashifyjs.triggers.createSpawn({ touchTrigger: true, target: 2, posX: 47, posY: 2, scale: 5 });
dashifyjs.triggers.createToggle({ posX: -100, posY: 1, target: 1, toggle: 0 });
dashifyjs.triggers.createReverse({ spawnTrigger: true, groupID: 2, posX: 47, posY: 10 });
dashifyjs.triggers.createToggle({ spawnTrigger: true, groupID: 2, posX: 47, posY: 10, target: 1, toggle: 1 });
dashifyjs.triggers.createEnd({ scale: 5, groupID: 1, posX: 1, posY: 1, touchTrigger: true });

dashifyjs.spikes.create("spike", { posX: 3, posY: 1 });
for (let i = 0; i < 20; i++) {
    if (i % 6 == 0) dashifyjs.triggers.createPulse({
        posX: (4 + i) + (i + 1) + 3,
        posY: 1,
        color: { r: 35, g: 99, b: 10 },
        channel: 1000
    });
    dashifyjs.blocks.create("cube", { posX: 4 + i + (i + 1), posY: 1 });
    dashifyjs.blocks.create("cube", { posX: 4 + i + (i + 1), posY: 10 });

    dashifyjs.spikes.create("spike", { posX: 4 + i + (i + 1), posY: 3 });
    dashifyjs.spikes.create("spike", { posX: 4 + i + (i + 1), posY: 8, flipY: true });
}
dashifyjs.portals.create("ship", { posX: 4, posY: 5 });

dashifyjs.specials.createText({ posX: 47, posY: 5, text: "DashifyJS" });

dashifyjs.Compiler.compile();

OR you could use them like this

import dashifyjs from "dashifyjs";

const alpha = dashifyjs.triggers.createAlpha();
alpha.setPosition({ x: 4, y: 4 });

dashifyjs.Compiler.compile();

How can i use triggers?

Here is an example

dashifyjs.triggers.createColor({ color: "10,255,5", channel: "BG", fadeTime: 0.4, posX: 11, posY: 2 }) // Create a color trigger, the "color" attribute can be a RGB type or a string like that, anything else will error out if you are using javascript. The "channel" attribute is the channel of the color attribute, This can also translate to a pulse object.

Here is a list of expirements

Ex.N 1

dashifyjs.level.createLevel("Expirement 01", "an expirement");
dashifyjs.specials.createText({ posX: 2, posY: 2, text: btoa("Decoded text!") }); // Use baes64-encoding with a text, using 'create' wont work since it does not provide a text attribute.

Developers

  1. ContentGamer

Q&A

Is anything possible with this package?

Yes, the package also has alot of triggers to use! Go crazy!

Why isn't there other objects in dashifyjs.blocks?

The only method in dashifyjs.blocks is create, with a name and a type (or Unique Identifier, i use this because i have alot of the same names), you can browse the json at the 'json'/blocks code to see all blocks i have currently put it.

Contact

You can contact with me on discord, or twitter!

  1. You can DM Me with discord at contentgamer
  2. Or you can DM Me with twitter Here
1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago

1.0.8

3 months ago

1.0.7

3 months ago

1.0.6

3 months ago

1.0.5

3 months ago

1.0.3

3 months ago

0.0.1

3 months ago