added week 7 songs + fixed charts

This commit is contained in:
Yoshman29
2022-10-08 13:21:16 +02:00
parent d94d7dc92f
commit 253482c552
65 changed files with 116 additions and 106 deletions
+52 -22
View File
@@ -1,6 +1,7 @@
package;
import flixel.FlxSprite;
import openfl.utils.Assets;
class HealthIcon extends FlxSprite
{
@@ -9,34 +10,51 @@ class HealthIcon extends FlxSprite
*/
public var sprTracker:FlxSprite;
/**
* Health steps in this format:
* Min Percentage => Frame Index
*/
public var healthSteps:Map<Int, Int> = [
0 => 1, // losing icon
20 => 0, // normal icon
];
/**
* Helper for HScript who can't make maps
* @param steps Something like this: `[[0, 1], [20, 0]]`
*/
public function setHealthSteps(steps:Array<Array<Int>>) { // helper for hscript that can't do maps
if (steps == null) return;
healthSteps = [];
for(s in steps)
if (s.length > 1)
healthSteps[s[0]] = s[1];
var am = 0;
for(k=>e in healthSteps) am++;
if (am <= 0) healthSteps = [
0 => 1, // losing icon
20 => 0, // normal icon
];
}
public function new(char:String = 'bf', isPlayer:Bool = false)
{
super();
loadGraphic(Paths.image('iconGrid'), true, 150, 150);
health = 0.5;
var path = Paths.image('icons/$char');
if (!Assets.exists(path)) path = Paths.image('icons/face');
// TODO: Icon Jsons?? (maybe not not to mess with sparrows but perhaps)
loadGraphic(path, true, 150, 150);
animation.add(char, [for(i in 0...frames.frames.length) i], 0, false, isPlayer);
antialiasing = true;
animation.add('bf', [0, 1], 0, false, isPlayer);
animation.add('bf-car', [0, 1], 0, false, isPlayer);
animation.add('bf-christmas', [0, 1], 0, false, isPlayer);
animation.add('bf-pixel', [21, 21], 0, false, isPlayer);
animation.add('spooky', [2, 3], 0, false, isPlayer);
animation.add('pico', [4, 5], 0, false, isPlayer);
animation.add('mom', [6, 7], 0, false, isPlayer);
animation.add('mom-car', [6, 7], 0, false, isPlayer);
animation.add('tankman', [8, 9], 0, false, isPlayer);
animation.add('face', [10, 11], 0, false, isPlayer);
animation.add('dad', [12, 13], 0, false, isPlayer);
animation.add('senpai', [22, 22], 0, false, isPlayer);
animation.add('senpai-angry', [22, 22], 0, false, isPlayer);
animation.add('spirit', [23, 23], 0, false, isPlayer);
animation.add('bf-old', [14, 15], 0, false, isPlayer);
animation.add('gf', [16], 0, false, isPlayer);
animation.add('parents-christmas', [17], 0, false, isPlayer);
animation.add('monster', [19, 20], 0, false, isPlayer);
animation.add('monster-christmas', [19, 20], 0, false, isPlayer);
animation.play(char);
if (animation.curAnim == null)
animation.play("face");
if (frames.frames.length >= 3)
healthSteps[80] = 2; // winning icon
scrollFactor.set();
}
@@ -46,5 +64,17 @@ class HealthIcon extends FlxSprite
if (sprTracker != null)
setPosition(sprTracker.x + sprTracker.width + 10, sprTracker.y - 30);
if (animation.curAnim != null) {
var i:Int = -1;
var oldKey:Int = -1;
for(k=>icon in healthSteps) {
if (k > oldKey && k < health * 100) {
oldKey = k;
i = icon;
}
}
if (i >= 0) animation.curAnim.curFrame = i;
}
}
}
+10 -4
View File
@@ -40,6 +40,8 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
public var playerOffsets:Bool = false;
public var icon:String = null;
public var cameraOffset:FlxPoint = new FlxPoint(0, 0);
public var globalOffset:FlxPoint = new FlxPoint(0, 0);
@@ -68,9 +70,8 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
// load xml
if (!Assets.exists(Paths.xml('characters/$curCharacter'))) {
curCharacter = "bf";
continue; // load bf instead
continue;
}
var plainXML = Assets.getText(Paths.xml('characters/$curCharacter'));
var character:Access;
@@ -80,7 +81,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
character = new Access(charXML);
} catch(e) {
trace(e);
curCharacter = "bf"; // load fallback
curCharacter = "bf";
continue;
}
@@ -91,6 +92,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
if (character.has.camx) cameraOffset.x = Std.parseFloat(character.att.camx);
if (character.has.camy) cameraOffset.y = Std.parseFloat(character.att.camy);
if (character.has.flipX) flipX = (character.att.flipX == "true");
if (character.has.icon) icon = character.att.icon;
frames = Paths.getSparrowAtlas('characters/$curCharacter');
for(anim in character.nodes.anim) {
@@ -683,7 +685,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
offset.set(daOffset.x * (isPlayer != playerOffsets ? -1 : 1), daOffset.y);
else
offset.set(0, 0);
offset.x += globalOffset.x - (isPlayer != playerOffsets ? 1 : -1);
offset.y -= globalOffset.y;
@@ -712,6 +714,10 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
super.destroy();
}
public inline function getIcon() {
return (icon != null) ? icon : curCharacter;
}
public function addOffset(name:String, x:Float = 0, y:Float = 0)
{
animOffsets[name] = new FlxPoint(x, y);
+7 -12
View File
@@ -150,6 +150,8 @@ class PlayState extends MusicBeatState
FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD, false);
// camGame.widescreen = true;
persistentUpdate = true;
persistentDraw = true;
@@ -259,11 +261,11 @@ class PlayState extends MusicBeatState
scoreTxt.scrollFactor.set();
add(scoreTxt);
iconP1 = new HealthIcon(SONG.player1, true);
iconP1 = new HealthIcon(boyfriend.getIcon(), true);
iconP1.y = healthBar.y - (iconP1.height / 2);
add(iconP1);
iconP2 = new HealthIcon(SONG.player2, false);
iconP2 = new HealthIcon(dad.getIcon(), false);
iconP2.y = healthBar.y - (iconP2.height / 2);
add(iconP2);
@@ -795,16 +797,9 @@ class PlayState extends MusicBeatState
if (health > 2)
health = 2;
if (healthBar.percent < 20)
iconP1.animation.curAnim.curFrame = 1;
else
iconP1.animation.curAnim.curFrame = 0;
if (healthBar.percent > 80)
iconP2.animation.curAnim.curFrame = 1;
else
iconP2.animation.curAnim.curFrame = 0;
iconP1.health = health / 2;
iconP2.health = 1 - (health / 2);
/* if (FlxG.keys.justPressed.NINE)
FlxG.switchState(new Charting()); */
+7 -17
View File
@@ -62,23 +62,13 @@ class FreeplayState extends MusicBeatState
isDebug = true;
#end
if (StoryMenuState.weekUnlocked[2] || isDebug)
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
if (StoryMenuState.weekUnlocked[2] || isDebug)
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
if (StoryMenuState.weekUnlocked[3] || isDebug)
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
if (StoryMenuState.weekUnlocked[4] || isDebug)
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
if (StoryMenuState.weekUnlocked[5] || isDebug)
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
if (StoryMenuState.weekUnlocked[6] || isDebug)
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
addWeek(['Satin Panties', 'High', 'Milf'], 4, ['mom']);
addWeek(['Cocoa', 'Eggnog', 'Winter Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster']);
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
addWeek(['Ugh', 'Guns', 'Stress'], 7, ['tankman']);
// LOAD MUSIC