diff --git a/source/Girlfriend.hx b/source/Girlfriend.hx new file mode 100644 index 000000000..c22493615 --- /dev/null +++ b/source/Girlfriend.hx @@ -0,0 +1,35 @@ +package; + +import flixel.graphics.frames.FlxAtlasFrames; + +class Girlfriend extends Character +{ + public function new(x:Float, y:Float) + { + super(x, y); + + var tex = FlxAtlasFrames.fromSparrow(AssetPaths.GF_assets__png, AssetPaths.GF_assets__xml); + frames = tex; + animation.addByPrefix('cheer', 'GF Cheer'); + animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); + animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); + + addOffset('cheer'); + addOffset('danceLeft'); + addOffset('danceRight'); + + playAnim('danceRight'); + } + + private var danced:Bool = false; + + public function dance() + { + danced = !danced; + + if (danced) + playAnim('danceRight'); + else + playAnim('danceLeft'); + } +} diff --git a/source/PlayState.hx b/source/PlayState.hx index 28be58897..8952641eb 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -32,6 +32,7 @@ class PlayState extends FlxState private var totalSteps:Int = 0; private var dad:Dad; + private var gf:Girlfriend; private var boyfriend:Boyfriend; private var notes:FlxTypedGroup; @@ -60,6 +61,10 @@ class PlayState extends FlxState bg.active = false; add(bg); + gf = new Girlfriend(400, 130); + gf.scrollFactor.set(0.95, 0.95); + add(gf); + dad = new Dad(100, 100); add(dad); @@ -632,7 +637,8 @@ class PlayState extends FlxState totalBeats += 1; - dad.animation.play('idle'); + dad.playAnim('idle'); + gf.dance(); if (!boyfriend.animation.curAnim.name.startsWith("sing")) boyfriend.playAnim('idle');