pico in progress

This commit is contained in:
Cameron Taylor 2021-03-29 10:24:49 -07:00
parent f1325d31e5
commit 526f91fe5f
3 changed files with 46 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
package;
import Section.SwagSection;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.animation.FlxBaseAnimation;
@ -18,6 +19,8 @@ class Character extends FlxSprite
public var holdTimer:Float = 0;
public var animationNotes:Array<Dynamic> = [];
public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false)
{
super(x, y);
@ -287,6 +290,8 @@ class Character extends FlxSprite
loadOffsetFile(curCharacter);
playAnim('shoot1');
loadMappedAnims();
case 'bf':
var tex = Paths.getSparrowAtlas('characters/BOYFRIEND');
frames = tex;
@ -563,6 +568,23 @@ class Character extends FlxSprite
}
}
public function loadMappedAnims()
{
var swagshit = Song.loadFromJson('picospeaker', 'stress');
var notes = swagshit.notes;
for (section in notes)
{
for (idk in section.sectionNotes)
{
animationNotes.push(idk);
}
}
trace(animationNotes);
}
function quickAnimAdd(name:String, prefix:String)
{
animation.addByPrefix(name, prefix, 24, false);
@ -604,6 +626,25 @@ class Character extends FlxSprite
case 'gf':
if (animation.curAnim.name == 'hairFall' && animation.curAnim.finished)
playAnim('danceRight');
case "pico-speaker":
// for pico??
if (animationNotes.length > 0)
{
if (Conductor.songPosition > animationNotes[0][0])
{
trace('played shoot anim' + animationNotes[0][1]);
var shootAnim:Int = 1;
if (animationNotes[0][1] >= 2)
shootAnim = 3;
shootAnim += FlxG.random.int(0, 1);
playAnim('shoot' + shootAnim, true);
animationNotes.shift();
}
}
}
super.update(elapsed);
@ -663,7 +704,8 @@ class Character extends FlxSprite
playAnim('danceLeft');
}
case 'pico-speaker':
playAnim('shoot' + FlxG.random.int(1, 4), true);
// lol weed
// playAnim('shoot' + FlxG.random.int(1, 4), true);
case 'spooky':
danced = !danced;

View File

@ -710,7 +710,7 @@ class PlayState extends MusicBeatState
// startCountdown();
generateSong(SONG.song);
generateSong();
// add(strumLine);
@ -1084,7 +1084,7 @@ class PlayState extends MusicBeatState
var debugNum:Int = 0;
private function generateSong(dataPath:String):Void
private function generateSong():Void
{
// FlxG.log.add(ChartParser.parse());