Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom capsule colors #3440

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a new Character Select screen to switch between playable characters in Freeplay
- Modding isn't 100% there but we're working on it!
- Added Pico as a playable character! Unlock him by completing Weekend 1 (if you haven't already done that)
- The songs from Weekend 1 have moved; you must now switch to Pico in Freeplay to access them
- Added 10 new Pico remixes! Access them by selecting Pico from in the Character Select screen
- The songs from Weekend 1 have moved; you must now switch to Pico via Character Select screen in Freeplay to access them
- Added 11 new Pico remixes! Access them by selecting Pico from in the Character Select screen
- Bopeebo (Pico Mix)
- Fresh (Pico Mix)
- DadBattle (Pico Mix)
- Spookeez (Pico Mix)
- South (Pico Mix)
- Pico (Pico Mix)
- Philly Nice (Pico Mix)
- Blammed (Pico Mix)
- Blammed (Pico Mix)
- Eggnog (Pico Mix)
- Ugh (Pico Mix)
- Guns (Pico Mix)
- Added 1 new Boyfriend remix! Access it by selecting Pico from in the Character Select screen
- Added 1 new Boyfriend remix! Access it by completing Weekend 1 as Pico and then selecting Boyfriend from in the Character Select screen
- Darnell (BF Mix)
- Added 2 new Erect remixes! Access them by switching difficulty on the song
- Cocoa Erect
Expand All @@ -39,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- These display on Pico remixes, as well as when playing Weekend 1.
- Implemented support for scripted Note Kinds. You can use HScript define a different note style to display for these notes as well as custom behavior. (community feature by lemz1)
- Implemented support for Numeric and Selector options in the Options menu. (community feature by FlooferLand)
- Implemented new animations for Tankman and Pico
## Changed
- Girlfriend and Nene now perform previously unused animations when you achieve a large combo, or drop a large combo.
- The pixel character icons in the Freeplay menu now display an animation!
Expand Down
2 changes: 1 addition & 1 deletion assets
13 changes: 7 additions & 6 deletions source/funkin/data/freeplay/style/FreeplayStyleData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ typedef FreeplayStyleData =
* Asset key for the numbers shown at the top right of the screen.
*/
public var numbersAsset:String;

/**
* Asset key for the freeplay capsules.
*/
public var capsuleAsset:String;


/**
* Color data for the capsule text outline.
* the order of this array goes as follows: [DESELECTED, SELECTED]
*/
public var capsuleTextColors:Array<String>;

/**
* Color data for the capsule colors.
* the order of this array goes as follows: [SELECTED, DESELECTED, GLOW]
*/
public var capsuleColors:Array<String>;

/**
* Delay time after confirming a song selection, before entering PlayState.
* Useful for letting longer animations play out.
Expand Down
39 changes: 30 additions & 9 deletions source/funkin/ui/freeplay/FreeplayStyle.hx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ class FreeplayStyle implements IRegistryEntry<FreeplayStyleData>
return _data.selectorAsset;
}

/**
* Get the asset key for the number assets.
* @return The asset key
*/
public function getCapsuleAssetKey():String
{
return _data.capsuleAsset;
}

/**
* Get the asset key for the capsule art.
* @return The asset key
Expand All @@ -88,6 +79,36 @@ class FreeplayStyle implements IRegistryEntry<FreeplayStyleData>
return FlxColor.fromString(_data.capsuleTextColors[0]);
}

/**
* Return the color of the selected capsule bg
* for freeplay capsules.
* @return The color
*/
public function getCapsuleBGcolor():FlxColor
{
return FlxColor.fromString(_data.capsuleColors[0]);
}

/**
* Return the deselected color of the capsule bg
* for freeplay capsules.
* @return The deselected color
*/
public function getCapsuleBGdeselectedColor():FlxColor
{
return FlxColor.fromString(_data.capsuleColors[1]);
}

/**
* Return the glow color for the capsule
* for freeplay capsules.
* @return The glow color
*/
public function getCapsuleGlowColor():FlxColor
{
return FlxColor.fromString(_data.capsuleColors[2]);
}

/**
* Return the song selection transition delay.
* @return The start delay
Expand Down
104 changes: 75 additions & 29 deletions source/funkin/ui/freeplay/SongMenuItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import funkin.ui.PixelatedIcon;

class SongMenuItem extends FlxSpriteGroup
{
public var capsule:FlxSprite;
public var capsule:CapsuleSprite;

var pixelIcon:PixelatedIcon;

Expand Down Expand Up @@ -77,8 +77,6 @@ class SongMenuItem extends FlxSpriteGroup

public var weekNumbers:Array<CapsuleNumber> = [];

var impactThing:FunkinSprite;

public var sparkle:FlxSprite;

var sparkleTimer:FlxTimer;
Expand All @@ -87,11 +85,7 @@ class SongMenuItem extends FlxSpriteGroup
{
super(x, y);

capsule = new FlxSprite();
capsule.frames = Paths.getSparrowAtlas('freeplay/freeplayCapsule/capsule/freeplayCapsule');
capsule.animation.addByPrefix('selected', 'mp3 capsule w backing0', 24);
capsule.animation.addByPrefix('unselected', 'mp3 capsule w backing NOT SELECTED', 24);
// capsule.animation
capsule = new CapsuleSprite(0xFF87B5CB, 0xFF505BA9, 0xFF53B1EA);
add(capsule);

bpmText = new FlxSprite(144, 87).loadGraphic(Paths.image('freeplay/freeplayCapsule/bpmtext'));
Expand Down Expand Up @@ -375,20 +369,7 @@ class SongMenuItem extends FlxSpriteGroup

public function fadeAnim():Void
{
impactThing = new FunkinSprite(0, 0);
impactThing.frames = capsule.frames;
impactThing.frame = capsule.frame;
impactThing.updateHitbox();
// impactThing.x = capsule.x;
// impactThing.y = capsule.y;
// picoFade.stamp(this, 0, 0);
impactThing.alpha = 0;
impactThing.zIndex = capsule.zIndex - 3;
add(impactThing);
FlxTween.tween(impactThing.scale, {x: 2.5, y: 2.5}, 0.5);
// FlxTween.tween(impactThing, {alpha: 0}, 0.5);

evilTrail = new FlxTrail(impactThing, null, 15, 2, 0.01, 0.069);
evilTrail = new FlxTrail(capsule.capsule, null, 15, 2, 0.01, 0.069);
evilTrail.blend = BlendMode.ADD;
evilTrail.zIndex = capsule.zIndex - 5;
FlxTween.tween(evilTrail, {alpha: 0}, 0.6,
Expand Down Expand Up @@ -467,7 +448,8 @@ class SongMenuItem extends FlxSpriteGroup
function set_hsvShader(value:HSVShader):HSVShader
{
this.hsvShader = value;
capsule.shader = hsvShader;
capsule.capsule.shader = hsvShader;
capsule.glow.shader = hsvShader;
songText.shader = hsvShader;

return value;
Expand Down Expand Up @@ -511,9 +493,7 @@ class SongMenuItem extends FlxSpriteGroup
// capsule.frames = Paths.getSparrowAtlas(styleData == null ? 'freeplay/freeplayCapsule/capsule/freeplayCapsule' : styleData.getCapsuleAssetKey()); thank u luv u
if (styleData != null)
{
capsule.frames = Paths.getSparrowAtlas(styleData.getCapsuleAssetKey());
capsule.animation.addByPrefix('selected', 'mp3 capsule w backing0', 24);
capsule.animation.addByPrefix('unselected', 'mp3 capsule w backing NOT SELECTED', 24);
capsule.reapplyColors(styleData.getCapsuleBGcolor(), styleData.getCapsuleBGdeselectedColor(),styleData.getCapsuleGlowColor());
songText.applyStyle(styleData);
}

Expand Down Expand Up @@ -603,7 +583,6 @@ class SongMenuItem extends FlxSpriteGroup

override function update(elapsed:Float):Void
{
if (impactThing != null) impactThing.angle = capsule.angle;

// if (FlxG.keys.justPressed.I)
// {
Expand Down Expand Up @@ -702,8 +681,10 @@ class SongMenuItem extends FlxSpriteGroup
grayscaleShader.setAmount(this.selected ? 0 : 0.8);
songText.alpha = this.selected ? 1 : 0.6;
songText.blurredText.visible = this.selected ? true : false;
capsule.offset.x = this.selected ? 0 : -5;
capsule.animation.play(this.selected ? "selected" : "unselected");
if(this.selected)
capsule.select();
else
capsule.deselect();
ranking.alpha = this.selected ? 1 : 0.7;
favIcon.alpha = this.selected ? 1 : 0.6;
favIconBlurred.alpha = this.selected ? 1 : 0;
Expand All @@ -715,6 +696,71 @@ class SongMenuItem extends FlxSpriteGroup
}
}


class CapsuleSprite extends FlxSpriteGroup{
public var bg:FlxSprite;
public var capsule:FlxSprite;
public var glow:FlxSprite;

var bgColor = 0xFF87B5CB;
var bgColorDeselected = 0xFF505BA9;

var selected = false;

public function select(){
glow.offset.x = 0;
glow.animation.play("selected");
capsule.animation.resume();
bg.makeGraphic(400, 70, bgColor);
selected = true;
}

public function deselect(){
glow.offset.x = -5;
glow.animation.play("unselected");
capsule.animation.pause();
bg.makeGraphic(400, 70, bgColorDeselected);
selected = false;
}

public function reapplyColors(bgColor, bgColorDeselected, glowColor){
this.bgColor = bgColor;
this.bgColorDeselected = bgColorDeselected;
glow.color = glowColor;

//reapply colors
if(selected)
select();
else
deselect();

}


override public function new(bgColor,bgColorDeselected,glowColor){
super(x,y);

this.bgColor = bgColor;
this.bgColorDeselected = bgColorDeselected;

bg = new FlxSprite(104, 23).makeGraphic(400, 70, bgColor);
add(bg);

capsule = new FlxSprite(49,13);
capsule.frames = Paths.getSparrowAtlas('freeplay/freeplayCapsule/capsule/capsule');
capsule.animation.addByPrefix('idle', 'capsule', 24);
capsule.animation.play('idle',true);
add(capsule);

glow = new FlxSprite(0, 0);
glow.frames = Paths.getSparrowAtlas('freeplay/freeplayCapsule/capsule/capsuleGlow');
glow.animation.addByPrefix('selected', 'selected', 24);
glow.animation.addByPrefix('unselected', 'not selected', 24);
glow.color = glowColor;
add(glow);
}
}

class FreeplayRank extends FlxSprite
{
public var rank(default, set):Null<ScoringRank> = null;
Expand Down
Loading