1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-24 22:26:50 +00:00

re added sustain notes lol

This commit is contained in:
Cameron Taylor 2020-10-19 18:59:00 -07:00
parent d158afdaf7
commit 87d0b36070
3 changed files with 53 additions and 30 deletions

View file

@ -370,6 +370,17 @@ class ChartingState extends MusicBeatState
} }
}); });
} }
else
{
if (FlxG.mouse.x > gridBG.x
&& FlxG.mouse.x < gridBG.x + gridBG.width
&& FlxG.mouse.y > gridBG.y
&& FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps))
{
FlxG.log.add('added note');
addNote();
}
}
} }
if (FlxG.mouse.x > gridBG.x if (FlxG.mouse.x > gridBG.x
@ -382,15 +393,6 @@ class ChartingState extends MusicBeatState
dummyArrow.y = FlxG.mouse.y; dummyArrow.y = FlxG.mouse.y;
else else
dummyArrow.y = Math.floor(FlxG.mouse.y / GRID_SIZE) * GRID_SIZE; dummyArrow.y = Math.floor(FlxG.mouse.y / GRID_SIZE) * GRID_SIZE;
if (FlxG.mouse.justPressed)
{
if (!FlxG.mouse.overlaps(curRenderedNotes))
{
FlxG.log.add('added note');
addNote();
}
}
} }
if (FlxG.keys.justPressed.ENTER) if (FlxG.keys.justPressed.ENTER)
@ -587,7 +589,7 @@ class ChartingState extends MusicBeatState
{ {
for (i in _song.notes[curSection].sectionNotes) for (i in _song.notes[curSection].sectionNotes)
{ {
if (i.strumTime == note.strumTime && i.noteData % 4 == note.noteData) if (i[0] == note.strumTime && i[1] % 4 == note.noteData)
{ {
FlxG.log.add('FOUND EVIL NUMBER'); FlxG.log.add('FOUND EVIL NUMBER');
_song.notes[curSection].sectionNotes.remove(i); _song.notes[curSection].sectionNotes.remove(i);

View file

@ -16,6 +16,7 @@ class Note extends FlxSprite
public var prevNote:Note; public var prevNote:Note;
public var sustainLength:Float = 0; public var sustainLength:Float = 0;
public var isSustainNote:Bool = false;
public var noteScore:Float = 1; public var noteScore:Float = 1;
@ -25,7 +26,7 @@ class Note extends FlxSprite
public static var BLUE_NOTE:Int = 1; public static var BLUE_NOTE:Int = 1;
public static var RED_NOTE:Int = 3; public static var RED_NOTE:Int = 3;
public function new(strumTime:Float, noteData:Int, ?prevNote:Note) public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false)
{ {
super(); super();
@ -33,6 +34,7 @@ class Note extends FlxSprite
prevNote = this; prevNote = this;
this.prevNote = prevNote; this.prevNote = prevNote;
isSustainNote = sustainNote;
x += 50; x += 50;
this.strumTime = strumTime; this.strumTime = strumTime;
@ -78,7 +80,7 @@ class Note extends FlxSprite
trace(prevNote); trace(prevNote);
if (noteData < 0 && prevNote != null) if (isSustainNote && prevNote != null)
{ {
noteScore * 0.2; noteScore * 0.2;
alpha = 0.6; alpha = 0.6;
@ -87,13 +89,13 @@ class Note extends FlxSprite
switch (noteData) switch (noteData)
{ {
case -1: case 2:
animation.play('greenholdend'); animation.play('greenholdend');
case -2: case 3:
animation.play('redholdend'); animation.play('redholdend');
case -3: case 1:
animation.play('blueholdend'); animation.play('blueholdend');
case -4: case 0:
animation.play('purpleholdend'); animation.play('purpleholdend');
} }
@ -101,22 +103,22 @@ class Note extends FlxSprite
x -= width / 2; x -= width / 2;
if (prevNote.noteData < 0) if (prevNote.isSustainNote)
{ {
switch (prevNote.noteData) switch (prevNote.noteData)
{ {
case -1: case 2:
prevNote.animation.play('greenhold'); prevNote.animation.play('greenhold');
case -2: case 3:
prevNote.animation.play('redhold'); prevNote.animation.play('redhold');
case -3: case 1:
prevNote.animation.play('bluehold'); prevNote.animation.play('bluehold');
case -4: case 0:
prevNote.animation.play('purplehold'); prevNote.animation.play('purplehold');
} }
prevNote.offset.y = -19; prevNote.offset.y = -19;
prevNote.scale.y *= 2.25; prevNote.scale.y *= (2.25 * PlayState.SONG.speed);
// prevNote.setGraphicSize(); // prevNote.setGraphicSize();
} }
} }

View file

@ -274,8 +274,8 @@ class PlayState extends MusicBeatState
sectionScores[0].push(0); sectionScores[0].push(0);
sectionScores[1].push(0); sectionScores[1].push(0);
var daStrumTime:Float = songNotes.strumTime; var daStrumTime:Float = songNotes[0];
var daNoteData:Int = Std.int(songNotes.noteData % 4); var daNoteData:Int = Std.int(songNotes[1] % 4);
var gottaHitNote:Bool = section.mustHitSection; var gottaHitNote:Bool = section.mustHitSection;
@ -291,11 +291,30 @@ class PlayState extends MusicBeatState
oldNote = null; oldNote = null;
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote); var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
swagNote.sustainLength = songNotes.sustainLength; swagNote.sustainLength = songNotes[2];
swagNote.scrollFactor.set(0, 0); swagNote.scrollFactor.set(0, 0);
var susLength:Float = swagNote.sustainLength;
susLength = susLength / Conductor.stepCrochet;
unspawnNotes.push(swagNote); unspawnNotes.push(swagNote);
for (susNote in 0...Math.floor(susLength))
{
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote), daNoteData, oldNote, true);
sustainNote.scrollFactor.set();
unspawnNotes.push(sustainNote);
sustainNote.mustPress = gottaHitNote;
if (sustainNote.mustPress)
{
sustainNote.x += FlxG.width / 2; // general offset
}
}
swagNote.mustPress = gottaHitNote; swagNote.mustPress = gottaHitNote;
if (swagNote.mustPress) if (swagNote.mustPress)
@ -891,21 +910,21 @@ class PlayState extends MusicBeatState
{ {
notes.forEach(function(daNote:Note) notes.forEach(function(daNote:Note)
{ {
if (daNote.canBeHit && daNote.mustPress) if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote)
{ {
switch (daNote.noteData) switch (daNote.noteData)
{ {
// NOTES YOU ARE HOLDING // NOTES YOU ARE HOLDING
case -1: case 2:
if (up && daNote.prevNote.wasGoodHit) if (up && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
case -2: case 3:
if (right && daNote.prevNote.wasGoodHit) if (right && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
case -3: case 1:
if (down && daNote.prevNote.wasGoodHit) if (down && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
case -4: case 0:
if (left && daNote.prevNote.wasGoodHit) if (left && daNote.prevNote.wasGoodHit)
goodNoteHit(daNote); goodNoteHit(daNote);
} }