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);
}

View file

@ -492,7 +492,7 @@ class PlayState extends MusicBeatState
*/
case 'guns' | 'stress' | 'ugh':
// defaultCamZoom = 0.95;
defaultCamZoom = 0.90;
curStage = 'tank';
var bg:BGSprite = new BGSprite('tankSky', 0, -200, 0, 0);
@ -591,6 +591,13 @@ class PlayState extends MusicBeatState
case 'pico-speaker':
gf.x -= 50;
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);
@ -2017,8 +2024,18 @@ class PlayState extends MusicBeatState
{
// control arrays, order L D R U
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 releaseArray:Array<Bool> = [controls.NOTE_LEFT_R, controls.NOTE_DOWN_R, controls.NOTE_UP_R, controls.NOTE_RIGHT_R];
var pressArray:Array<Bool> = [
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
if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
@ -2071,7 +2088,7 @@ class PlayState extends MusicBeatState
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();
notes.remove(note, true);
note.destroy();
@ -2321,7 +2338,8 @@ class PlayState extends MusicBeatState
override function 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();
}
@ -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)
{
lightningStrikeShit();

View file

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

View file

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