more Good Stuff!!

This commit is contained in:
MeowcaTheoRange 2022-04-27 12:39:10 -05:00
parent f033a29d3b
commit 95b6b9bb7d
3 changed files with 56 additions and 110 deletions

View file

@ -159,26 +159,27 @@ If you're not using custom character definitions (see below), you also have 2 mo
The default note is labelled as `noteDefault`, and can be used if you want a specific character to make a default note.
Here's a good use, to define a note that will be empty and full, for making something of a duet:
```js
function(time, letter, prevStep) {
noteDefault(time, letter, prevStep); //The aformentioned default note value, with all of the variables being passed into it.
add([
rect(0, 50), // Some visibility comp is required in order for the detection system to work. If you want your note to be invisible, set no color and make your rect's width 0.
pos(width(), 20), // Pos comp is required. Simply Kaboom rules.
("note" + prevStep), // Required for all notes, uses variable prevStep.
"note", // Required for all notes
{
created: time, // Required, uses variable time.
empty: true, // Determines whether the note can be pressed by the player or not.
normal: true, // If true, this note will not pass a function.
function: undefined, // A function that will be ran when the note is hit, if the note is not normal.
type: letter // Required, uses variable letter.
}
]);
function(time, prevStep) {
noteDefault(time, "PUT YOUR CORRESPONDING LETTER HERE", prevStep); //The aformentioned default note value, with all of the variables being passed into it.
customNote(time, "PUT YOUR CORRESPONDING LETTER HERE", prevStep, 0, [0, 0, 0], true);
}
```
`time` will return the current time of the song in milliseconds.
`letter` will return the letter that made this note.
> `customNote` is also a really good helper function for easily defining... custom notes. The internal variables `time, letter, prevStep, w, colorArray, empty,` and `funclol` are used as so:
>
> `time` is where you pass in the variable with the same name, just like `noteDefault`. This is same with `prevStep`.
>
> `letter` is where you put the letter that spawns the note, as a way of identification by other modules.
>
> `w` is the width of your note. You can't change the height, because... why would you need to. Default width is usually 10.
>
> `colorArray` is the color of your note. If you want to make a sprite note instead, you'll have to use Kaboom's `add()` function instead.
>
> `empty` determines if this note is empty, which means the player cannot hit this note. Instead, this note will be handled by a seperate "player", designated for only hitting these notes. Animations and actions will also be passed into another player, labelled `players.empty`.
>
> Finally, `funclol` is where you put the function that runs when you hit this note. Including this automatically makes your note "[not normal.](https://i.kym-cdn.com/entries/icons/original/000/037/442/you_are_not_normal.jpg)" Passing parameters are `empty`, `curBeat`, and `letter`.
`time` will return the current time of the song in milliseconds.
`prevStep` will return the step that this note was made on.

View file

@ -365,59 +365,23 @@ export var charts = [
["Tails", "Tails"]
],
noteTypes: {
"J": function(time, letter, prevStep, char) {
"J": function(time, prevStep, char) {
if (char == "Tails") {
add([
rect(0, 50),
pos(width(), 20),
("note" + prevStep),
"note",
"empty",
{
created: time,
empty: true,
normal: true,
type: letter
}
]);
customNote(time, "J", prevStep, 0, [0, 0, 0], true);
} else {
noteDefault(time, letter, prevStep, char)
noteDefault(time, "J", prevStep)
}
},
"T": function(time, letter, prevStep, char) {
"T": function(time, prevStep, char) {
if (char == "Tails") {
noteDefault(time, letter, prevStep, char)
noteDefault(time, "T", prevStep)
} else {
add([
rect(0, 50),
pos(width(), 20),
("note" + prevStep),
"note",
"empty",
{
created: time,
empty: true,
normal: true,
type: letter
}
]);
customNote(time, "T", prevStep, 0, [0, 0, 0], true);
}
},
"D": function(time, letter, prevStep) {
noteDefault(time, letter, prevStep);
add([
rect(0, 50),
pos(width(), 20),
("note" + prevStep),
"note",
"empty",
{
created: time,
empty: true,
normal: true,
type: letter
}
]);
"D": function(time, prevStep) {
noteDefault(time, "D", prevStep);
customNote(time, "D", prevStep, 0, [0, 0, 0], true);
}
},
makeScript: {
@ -482,59 +446,23 @@ export var charts = [
["Tails", "Tails"]
],
noteTypes: {
"J": function(time, letter, prevStep, char) {
"J": function(time, prevStep, char) {
if (char == "Tails") {
add([
rect(0, 50),
pos(width(), 20),
("note" + prevStep),
"note",
"empty",
{
created: time,
empty: true,
normal: true,
type: letter
}
]);
customNote(time, "J", prevStep, 0, [0, 0, 0], true);
} else {
noteDefault(time, letter, prevStep, char)
noteDefault(time, "J", prevStep)
}
},
"T": function(time, letter, prevStep, char) {
"T": function(time, prevStep, char) {
if (char == "Tails") {
noteDefault(time, letter, prevStep, char)
noteDefault(time, "T", prevStep)
} else {
add([
rect(0, 50),
pos(width(), 20),
("note" + prevStep),
"note",
"empty",
{
created: time,
empty: true,
normal: true,
type: letter
}
]);
customNote(time, "T", prevStep, 0, [0, 0, 0], true);
}
},
"D": function(time, letter, prevStep) {
noteDefault(time, letter, prevStep);
add([
rect(0, 50),
pos(width(), 20),
("note" + prevStep),
"note",
"empty",
{
created: time,
empty: true,
normal: true,
type: letter
}
]);
"D": function(time, prevStep) {
noteDefault(time, "D", prevStep);
customNote(time, "D", prevStep, 0, [0, 0, 0], true);
}
},
makeScript: {
@ -598,3 +526,20 @@ export function noteDefault(time, letter, prevStep) {
}
]);
}
export function customNote(time, letter, prevStep, w, colorArray, empty, funclol) {
add([
rect(w, 50),
pos(width(), 20),
colorArray ? color(colorArray[0], colorArray[1], colorArray[2]) : color(0, 0, 0),
("note" + prevStep),
"note",
{
created: time,
type: letter,
function: funclol,
empty: empty,
normal: funclol != undefined ? false : true
}
]);
}

View file

@ -254,7 +254,7 @@ scene("Game", (idx, noTrans) => {
}
if(j.pos.x <= strumLine && j.empty) {
if (!j.normal) {
j.function();
j.function(j.empty, curBeat, j.type);
}
destroy(j);
players.empty?.play("talk");
@ -401,7 +401,7 @@ scene("Game", (idx, noTrans) => {
function makeNote(letter) {
if (charts[idx.song].noteTypes.hasOwnProperty(letter)) {
charts[idx.song].noteTypes[letter](underlay.time(), letter, prevStep, char);
charts[idx.song].noteTypes[letter](underlay.time(), prevStep, char);
}
}
function judgeHitsLol() {
@ -417,7 +417,7 @@ scene("Game", (idx, noTrans) => {
hits++;
iv = true;
if (!j.normal) {
j.function();
j.function(j.empty, curBeat, j.type);
}
destroy(j); //Destroys note. No score.
noteClick.play("click");