1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-23 15:26:06 +00:00

tankman/picospeaker better syncs

This commit is contained in:
Cameron Taylor 2021-03-30 13:58:05 -07:00
parent 5b62681654
commit fe91708b9b
4 changed files with 34 additions and 26 deletions

View file

@ -501,6 +501,8 @@ class Character extends FlxSprite
} }
} }
TankmenBG.animationNotes = animationNotes;
trace(animationNotes); trace(animationNotes);
} }

View file

@ -492,7 +492,7 @@ class PlayState extends MusicBeatState
*/ */
case 'guns' | 'stress' | 'ugh': case 'guns' | 'stress' | 'ugh':
// defaultCamZoom = 0.95; defaultCamZoom = 0.90;
curStage = 'tank'; curStage = 'tank';
var bg:BGSprite = new BGSprite('tankSky', 0, -200, 0, 0); var bg:BGSprite = new BGSprite('tankSky', 0, -200, 0, 0);
@ -591,6 +591,13 @@ class PlayState extends MusicBeatState
case 'pico-speaker': case 'pico-speaker':
gf.x -= 50; gf.x -= 50;
gf.y -= 200; gf.y -= 200;
for (i in 0...TankmenBG.animationNotes.length)
{
var tankman:TankmenBG = new TankmenBG(500, 200 + FlxG.random.int(0, 150), TankmenBG.animationNotes[i][1] < 2);
tankman.strumTime = TankmenBG.animationNotes[i][0];
tankmanRun.add(tankman);
}
} }
dad = new Character(100, 100, SONG.player2); dad = new Character(100, 100, SONG.player2);
@ -2017,8 +2024,18 @@ class PlayState extends MusicBeatState
{ {
// control arrays, order L D R U // control arrays, order L D R U
var holdArray:Array<Bool> = [controls.NOTE_LEFT, controls.NOTE_DOWN, controls.NOTE_UP, controls.NOTE_RIGHT]; var holdArray:Array<Bool> = [controls.NOTE_LEFT, controls.NOTE_DOWN, controls.NOTE_UP, controls.NOTE_RIGHT];
var pressArray:Array<Bool> = [controls.NOTE_LEFT_P, controls.NOTE_DOWN_P, controls.NOTE_UP_P, controls.NOTE_RIGHT_P]; var pressArray:Array<Bool> = [
var releaseArray:Array<Bool> = [controls.NOTE_LEFT_R, controls.NOTE_DOWN_R, controls.NOTE_UP_R, controls.NOTE_RIGHT_R]; controls.NOTE_LEFT_P,
controls.NOTE_DOWN_P,
controls.NOTE_UP_P,
controls.NOTE_RIGHT_P
];
var releaseArray:Array<Bool> = [
controls.NOTE_LEFT_R,
controls.NOTE_DOWN_R,
controls.NOTE_UP_R,
controls.NOTE_RIGHT_R
];
// HOLDS, check for sustain notes // HOLDS, check for sustain notes
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic) if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
@ -2048,13 +2065,13 @@ class PlayState extends MusicBeatState
for (coolNote in possibleNotes) for (coolNote in possibleNotes)
{ {
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10) if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
{ // if it's the same note twice at < 10ms distance, just delete it { // if it's the same note twice at < 10ms distance, just delete it
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol // EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
dumbNotes.push(daNote); dumbNotes.push(daNote);
break; break;
} }
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime) else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
{ // if daNote is earlier than existing note (coolNote), replace { // if daNote is earlier than existing note (coolNote), replace
possibleNotes.remove(coolNote); possibleNotes.remove(coolNote);
possibleNotes.push(daNote); possibleNotes.push(daNote);
break; break;
@ -2071,7 +2088,7 @@ class PlayState extends MusicBeatState
for (note in dumbNotes) for (note in dumbNotes)
{ {
FlxG.log.add("killing dumb ass note at "+note.strumTime); FlxG.log.add("killing dumb ass note at " + note.strumTime);
note.kill(); note.kill();
notes.remove(note, true); notes.remove(note, true);
note.destroy(); note.destroy();
@ -2084,7 +2101,7 @@ class PlayState extends MusicBeatState
else if (possibleNotes.length > 0) else if (possibleNotes.length > 0)
{ {
for (shit in 0...pressArray.length) for (shit in 0...pressArray.length)
{ // if a direction is hit that shouldn't be { // if a direction is hit that shouldn't be
if (pressArray[shit] && !directionList.contains(shit)) if (pressArray[shit] && !directionList.contains(shit))
badNoteHit(); badNoteHit();
} }
@ -2321,7 +2338,8 @@ class PlayState extends MusicBeatState
override function stepHit() override function stepHit()
{ {
super.stepHit(); super.stepHit();
if (Math.abs(FlxG.sound.music.time - Conductor.songPosition) > 20 || (SONG.needsVoices && Math.abs(vocals.time - Conductor.songPosition) > 20)) if (Math.abs(FlxG.sound.music.time - Conductor.songPosition) > 20
|| (SONG.needsVoices && Math.abs(vocals.time - Conductor.songPosition) > 20))
{ {
resyncVocals(); resyncVocals();
} }
@ -2455,17 +2473,6 @@ class PlayState extends MusicBeatState
} }
} }
switch (curSong.toLowerCase())
{
case 'stress':
if (FlxG.random.bool())
{
var tank:TankmenBG = new TankmenBG(500, 200);
tank.strumTime = Conductor.songPosition + (Conductor.crochet * 4);
tankmanRun.add(tank);
}
}
if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset) if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset)
{ {
lightningStrikeShit(); lightningStrikeShit();

View file

@ -6,13 +6,15 @@ import haxe.display.Display.Package;
class TankmenBG extends FlxSprite class TankmenBG extends FlxSprite
{ {
public static var animationNotes:Array<Dynamic> = [];
public var strumTime:Float = 0; public var strumTime:Float = 0;
public var goingRight:Bool = false; public var goingRight:Bool = false;
public var tankSpeed:Float = 0.7; public var tankSpeed:Float = 0.7;
public var endingOffset:Float; public var endingOffset:Float;
public function new(x:Float, y:Float) public function new(x:Float, y:Float, isGoingRight:Bool)
{ {
super(x, y); super(x, y);
@ -25,12 +27,10 @@ class TankmenBG extends FlxSprite
animation.play('run'); animation.play('run');
y += FlxG.random.int(-40, 100); goingRight = isGoingRight;
endingOffset = FlxG.random.float(50, 200);
goingRight = FlxG.random.bool(); tankSpeed = FlxG.random.float(0.6, 1);
endingOffset = FlxG.random.float(0, 120);
tankSpeed = FlxG.random.float(0.65, 0.8);
if (goingRight) if (goingRight)
flipX = true; flipX = true;

View file

@ -1,6 +1,5 @@
package; package;
import animate.AnimationAtlas;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond; import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;