CPU Strum Lights

This commit is contained in:
Radhew 2021-05-18 23:59:13 -04:00
parent ca0d909e05
commit 84941b0d73

View File

@ -119,6 +119,7 @@ class PlayState extends MusicBeatState
public static var strumLineNotes:FlxTypedGroup<FlxSprite> = null;
public static var playerStrums:FlxTypedGroup<FlxSprite> = null;
public static var cpuStrums:FlxTypedGroup<FlxSprite> = null;
private var camZooming:Bool = false;
private var curSong:String = "";
@ -854,6 +855,7 @@ class PlayState extends MusicBeatState
add(strumLineNotes);
playerStrums = new FlxTypedGroup<FlxSprite>();
cpuStrums = new FlxTypedGroup<FlxSprite>();
// startCountdown();
@ -1576,15 +1578,23 @@ class PlayState extends MusicBeatState
babyArrow.ID = i;
if (player == 1)
switch (player)
{
playerStrums.add(babyArrow);
case 0:
cpuStrums.add(babyArrow);
case 1:
playerStrums.add(babyArrow);
}
babyArrow.animation.play('static');
babyArrow.x += 50;
babyArrow.x += ((FlxG.width / 2) * player);
cpuStrums.forEach(function(spr:FlxSprite)
{
spr.centerOffsets(); //CPU arrows start out slightly off-center
});
strumLineNotes.add(babyArrow);
}
}
@ -2278,6 +2288,22 @@ class PlayState extends MusicBeatState
dad.playAnim('singLEFT' + altAnim, true);
}
cpuStrums.forEach(function(spr:FlxSprite)
{
if (Math.abs(daNote.noteData) == spr.ID)
{
spr.animation.play('confirm', true);
}
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
{
spr.centerOffsets();
spr.offset.x -= 13;
spr.offset.y -= 13;
}
else
spr.centerOffsets();
});
#if windows
if (luaModchart != null)
luaModchart.executeState('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]);
@ -2348,6 +2374,14 @@ class PlayState extends MusicBeatState
});
}
cpuStrums.forEach(function(spr:FlxSprite)
{
if (spr.animation.finished)
{
spr.animation.play('static');
spr.centerOffsets();
}
});
if (!inCutscene)
keyShit();