Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

People, new updates! #5

Merged
merged 17 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 54 additions & 7 deletions docs/modchart.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ Returns the hud's y position

Set's the current camera's position in space

##### getCamX()
##### getCameraX()

Returns the current camera's x position

##### getCamY()
##### getCameraY()

Returns the current camera's y position

Expand All @@ -207,6 +207,12 @@ Set's the current camera's zoom

Set's the hud's zoom

### Strumline

##### setStrumlineY(float y)

Set's the y position of the strumLine

### Actors

##### getRenderedNotes()
Expand Down Expand Up @@ -243,6 +249,12 @@ Returns the note data of an note (0-3, left, down, up, right)

*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*

##### getRenderedNoteHit(int id)

Returns whether a rendered note must be hit by the player or not

*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*

##### isSustain(int id)

Returns whether a rendered note is a sustain note or not (if they appear as the trail)
Expand Down Expand Up @@ -275,7 +287,7 @@ Returns what the game would normally put the specified rendered note x.

##### anyNotes()

Returns the number of rendered notes on the screen.
Returns true if there are rendered notes, and returns false if there are none

##### getRenderedNoteStrumtime(int id)

Expand Down Expand Up @@ -375,13 +387,17 @@ Set's the angle for the sprite id

Set's the scale for the sprite id

##### setActorScaleX(float x, string/int id) **Currently broken**
##### setActorScaleXY(float scaleX, float scaleY, string/int id)

Set's the scale x for the sprite id
Set's the x and y scale for the sprite id

##### setActorScaleY(float y, string/int id) **Currently broken**
##### setActorFlipX(bool flip, string/int id)

Set's the scale y for the sprite id
Set's the x flip for the sprite id

##### setActorFlipY(bool flip, string/int id)

Set's the y flip for the sprite id

##### getActorWidth(string/int id)

Expand Down Expand Up @@ -418,3 +434,34 @@ Smoothly fade in to an alpha
##### tweenFadeOut(string/int id, float toAlpha, float time, string onComplete)

Smoothly fade out to an alpha






### Window & Screen

##### getWindowX()

Returns the window's x position

##### getWindowY()

Returns the window's y position

##### getScreenWidth()

Returns the width of the screen

##### getScreenHeight()

Returns the height of the screen

##### setWindowPos(int x, int y)

Sets the window's position

##### resizeWindow(int width, int height)

Resizes the window
9 changes: 8 additions & 1 deletion source/Alphabet.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package;

import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
Expand Down Expand Up @@ -36,11 +38,13 @@ class Alphabet extends FlxSpriteGroup
var xPosResetted:Bool = false;
var lastWasSpace:Bool = false;

var listOAlphabets:List<AlphaCharacter> = new List<AlphaCharacter>();

var splitWords:Array<String> = [];

var isBold:Bool = false;

public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false)
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false, shouldMove:Bool = false)
{
super(x, y);

Expand All @@ -58,6 +62,7 @@ class Alphabet extends FlxSpriteGroup
{
addText();
}

}
}

Expand Down Expand Up @@ -93,6 +98,7 @@ class Alphabet extends FlxSpriteGroup

// var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
listOAlphabets.add(letter);

if (isBold)
letter.createBold(character);
Expand Down Expand Up @@ -178,6 +184,7 @@ class Alphabet extends FlxSpriteGroup

// var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
var letter:AlphaCharacter = new AlphaCharacter(xPos, 55 * yMulti);
listOAlphabets.add(letter);
letter.row = curRow;
if (isBold)
{
Expand Down
126 changes: 78 additions & 48 deletions source/ChartingState.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package;

import flixel.FlxCamera;
import flixel.addons.ui.FlxUIText;
import haxe.zip.Writer;
import Conductor.BPMChangeEvent;
Expand Down Expand Up @@ -42,6 +43,10 @@ class ChartingState extends MusicBeatState
{
var _file:FileReference;

public var playClaps:Bool = false;

public var snap:Int = 1;

var UI_box:FlxUITabMenu;

/**
Expand Down Expand Up @@ -91,6 +96,8 @@ class ChartingState extends MusicBeatState
private var lastNote:Note;
var claps:Array<Note> = [];

public var snapText:FlxText;

override function create()
{
curSection = lastSection;
Expand All @@ -117,6 +124,14 @@ class ChartingState extends MusicBeatState
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
add(gridBG);

var blackBorder:FlxSprite = new FlxSprite(60,10).makeGraphic(120,100,FlxColor.BLACK);
blackBorder.scrollFactor.set();

blackBorder.alpha = 0.3;

snapText = new FlxText(60,10,0,"Snap: 1/" + snap + " (Control + Left or Right to change.)\nAdd Notes: 1-8 (or click)\n", 14);
snapText.scrollFactor.set();

gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);
add(gridBlackLine);

Expand Down Expand Up @@ -183,6 +198,11 @@ class ChartingState extends MusicBeatState
add(curRenderedNotes);
add(curRenderedSustains);

add(blackBorder);
add(snapText);



super.create();
}

Expand Down Expand Up @@ -263,6 +283,14 @@ class ChartingState extends MusicBeatState
stepperSongVol.value = FlxG.sound.music.volume;
stepperSongVol.name = 'song_instvol';


var hitsounds = new FlxUICheckBox(10, stepperSongVol.y + 35, null, null, "Play hitsounds", 100);
hitsounds.checked = false;
hitsounds.callback = function()
{
playClaps = hitsounds.checked;
};

var stepperSongVolLabel = new FlxText(74, 110, 'Instrumental Volume');

var characters:Array<String> = CoolUtil.coolTextFile(Paths.txt('characterList'));
Expand Down Expand Up @@ -328,7 +356,8 @@ class ChartingState extends MusicBeatState
tab_group_song.add(stepperVocalVolLabel);
tab_group_song.add(stepperSongVol);
tab_group_song.add(stepperSongVolLabel);

tab_group_song.add(hitsounds);

var tab_group_assets = new FlxUI(null, UI_box);
tab_group_assets.name = "Assets";
tab_group_assets.add(noteStyleDropDown);
Expand Down Expand Up @@ -436,7 +465,6 @@ class ChartingState extends MusicBeatState

var applyLength:FlxButton = new FlxButton(10, 100, 'Apply Data');

tab_group_note.add(writingNotesText);
tab_group_note.add(stepperSusLength);
tab_group_note.add(stepperSusLengthLabel);
tab_group_note.add(applyLength);
Expand Down Expand Up @@ -587,6 +615,12 @@ class ChartingState extends MusicBeatState
else
return _song.notes[curSection].lengthInSteps;
}*/

function stepStartTime(step):Float
{
return _song.bpm / (step / 4) / 60;
}

function sectionStartTime():Float
{
var daBPM:Int = _song.bpm;
Expand All @@ -608,71 +642,66 @@ class ChartingState extends MusicBeatState
{
updateHeads();

snapText.text = "Snap: 1/" + snap + " (Control + Left or Right to change.)\nAdd Notes: 1-8 (or click)\n";

curStep = recalculateSteps();

if (FlxG.keys.justPressed.ALT && UI_box.selected_tab == 0)
{
writingNotes = !writingNotes;
}

if (writingNotes)
writingNotesText.text = "WRITING NOTES";
else
writingNotesText.text = "";

/*if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT)
snap = snap * 2;
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.LEFT)
snap = Math.round(snap / 2);
if (snap >= 192)
snap = 192;
if (snap <= 1)
snap = 1;*/
Conductor.songPosition = FlxG.sound.music.time;
_song.song = typingShit.text;

var upP = controls.UP_P;
var rightP = controls.RIGHT_P;
var downP = controls.DOWN_P;
var leftP = controls.LEFT_P;
var left = FlxG.keys.justPressed.ONE;
var down = FlxG.keys.justPressed.TWO;
var up = FlxG.keys.justPressed.THREE;
var right = FlxG.keys.justPressed.FOUR;
var leftO = FlxG.keys.justPressed.FIVE;
var downO = FlxG.keys.justPressed.SIX;
var upO = FlxG.keys.justPressed.SEVEN;
var rightO = FlxG.keys.justPressed.EIGHT;

var controlArray:Array<Bool> = [leftP, downP, upP, rightP];
var pressArray = [left, down, up, right, leftO, downO, upO, rightO];

if ((upP || rightP || downP || leftP) && writingNotes)
for (p in 0...pressArray.length)
{
for(i in 0...controlArray.length)
{
if (controlArray[i])
{
for (n in 0..._song.notes[curSection].sectionNotes.length)
{
var note = _song.notes[curSection].sectionNotes[n];
if (note == null)
continue;
if (note[0] == Conductor.songPosition && note[1] % 4 == i)
{
trace('GAMING');
_song.notes[curSection].sectionNotes.remove(note);
}
}
trace('adding note');
_song.notes[curSection].sectionNotes.push([Conductor.songPosition, i, 0]);
updateGrid();
}
}

var i = pressArray[p];
if (i)
addNote(new Note(Conductor.songPosition,p));
}

strumLine.y = getYfromStrum((Conductor.songPosition - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps));

curRenderedNotes.forEach(function(note:Note)


if (playClaps)
{
if (FlxG.sound.music.playing)
curRenderedNotes.forEach(function(note:Note)
{
FlxG.overlap(strumLine, note, function(_, _)
if (FlxG.sound.music.playing)
{
if(!claps.contains(note))
FlxG.overlap(strumLine, note, function(_, _)
{
claps.push(note);
if(_song.notes[curSection].mustHitSection) FlxG.sound.play(Paths.sound('CLAP'));
else FlxG.sound.play(Paths.sound('SNAP'));
}
});
}
});

if(!claps.contains(note))
{
claps.push(note);
if(_song.notes[curSection].mustHitSection) FlxG.sound.play(Paths.sound('CLAP'));
else FlxG.sound.play(Paths.sound('SNAP'));
}
});
}
});
}
/*curRenderedNotes.forEach(function(note:Note) {
if (strumLine.overlaps(note) && strumLine.y == note.y) // yandere dev type shit
{
Expand Down Expand Up @@ -857,7 +886,7 @@ class ChartingState extends MusicBeatState
var shiftThing:Int = 1;
if (FlxG.keys.pressed.SHIFT)
shiftThing = 4;
if (!writingNotes)
if (!FlxG.keys.pressed.CONTROL)
{
if (FlxG.keys.justPressed.RIGHT || FlxG.keys.justPressed.D)
changeSection(curSection + shiftThing);
Expand Down Expand Up @@ -892,7 +921,8 @@ class ChartingState extends MusicBeatState
FlxG.sound.music.pause();
vocals.pause();

FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4);
FlxG.sound.music.time = curStep * Conductor.stepCrochet - (FlxG.mouse.wheel * Conductor.stepCrochet / snap);

vocals.time = FlxG.sound.music.time;
}

Expand Down
2 changes: 1 addition & 1 deletion source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class FreeplayState extends MusicBeatState

for (i in 0...songs.length)
{
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false);
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false, true);
songText.isMenuItem = true;
songText.targetY = i;
grpSongs.add(songText);
Expand Down
Loading