lajbel / mandarina Goto Github PK
View Code? Open in Web Editor NEW๐ A visual novel JavaScript library
Home Page: https://lajbel.github.io/mandarina/
๐ A visual novel JavaScript library
Home Page: https://lajbel.github.io/mandarina/
This tool should be called create-mandarina
, being like create-kaboom
package, it should have the options:
-t TypeScript project
-d Desktop Support
-v Version support
(maybe only fork Kaboom cli tool?)
// Show a background.
m.showBackground(m.k.rgb(255, 255, 255)),
// Show our character.
m.show("t", "normal").fadeIn().appearFrom("left"),
// Say something.
m.say("t", "Hi, I'm Deffy!"),
// TODO: Variables
m.say("t", "What's your name?"),
m.say("t", "Oh, cool name [name]"),
]);
m.start();
m._textbox = addTextbox(opt.textbox);
nextAction();
// User input
// TODO: Add support for customize keys
k.onUpdate(() => {
if (
k.isKeyPressed("space") ||
k.isKeyPressed("right") ||
k.isMousePressed()
) {
if (!isProcessingAction()) nextAction();
else skipAction();
}
if (k.isKeyPressed("left")) {
previousAction();
}
});
});
});
Would be cool to have the Deno Package in deno.land
const k = getGameData().k;
let audioPlay: KA.AudioPlay;
// TODO: Accept an audio options object
return createAction<"audio">({
id: "play_sound",
type: "audio",
Make the characters play a sound in every letter written.
},
write(this: KA.GameObj, text) {
// TODO: Pronouns replacement support
const writePromise = new Promise<void>((resolve) => {
textbox.text = "";
this.curChar = 0;
},
});
}
// TODO: Implement choices
export function choice() {
//
}
// All audio related actions
import type * as KA from "kaboom";
import { getGameData } from "../main";
import { createAction } from "../game";
// TODO: Maybe instead of use playSound and playMusic use play(channel)
export function playSound(audio: string) {
const { k } = getGameData();
let audioPlay: KA.AudioPlay;
// TODO: Accept an audio options object
Maybe when user define channels, the user can define if audio must stop when another
audio is played in the same channel.
Another options is define some channels by default (music, sounds, voices, etc.).
import { getGameData } from "../main";
import { createAction } from "../game";
// TODO: Is necessary an stopAudio()?
// Maybe when user define channels, the user can define if audio must stop when another
// audio is played in the same channel.
// Another options is define some channels by default (music, sounds, voices, etc.).
export function playAudio(
channel: string,
audio: string,
plugins: [ mandarinaPlugin, layerPlugin ],
});
const extractedPluginCtx: Partial<MandarinaPlugin> = {};
// get plugin context
Object.keys(k).forEach((key) => {
if (Object.keys(mandarinaPluginCtx).includes(key)) {
extractedPluginCtx[key] = k[key];
}
});
if (!extractedPluginCtx) throw new Error("Mandarina plugin not found");
// TODO: As `MandarinaPlugin` use in mandarina() method
mandarinaPluginCtx = extractedPluginCtx as MandarinaPlugin;
startNovel(mandarinaPluginCtx, opt);
return extractedPluginCtx as MandarinaPlugin;
}
export function getGameData(): GameData {
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.