Skip to content

Commit

Permalink
fixed the miss purple
Browse files Browse the repository at this point in the history
  • Loading branch information
Blantados committed Jul 28, 2024
1 parent df4093e commit 86d812e
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 14 deletions.
Binary file modified assets/shared/images/characters/darnell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions source/backend/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,25 @@ class CoolUtil
return Std.string(daTxt);
}

public static function blendColors(bgColor: Int, ovColor: Int): Int {
var a_bg = (bgColor >> 24) & 0xFF;
var r_bg = (bgColor >> 16) & 0xFF;
var g_bg = (bgColor >> 8) & 0xFF;
var b_bg = bgColor & 0xFF;

var a_ov = (ovColor >> 24) & 0xFF;
var r_ov = (ovColor >> 16) & 0xFF;
var g_ov = (ovColor >> 8) & 0xFF;
var b_ov = ovColor & 0xFF;

var alpha = a_ov + (a_bg * (255 - a_ov) / 255);
var red = r_ov * (a_ov / 255) + r_bg * (1 - (a_ov / 255));
var green = g_ov * (a_ov / 255) + g_bg * (1 - (a_ov / 255));
var blue = b_ov * (a_ov / 255) + b_bg * (1 - (a_ov / 255));

return (Std.int(alpha) << 24) | (Std.int(red) << 16) | (Std.int(green) << 8) | Std.int(blue);
}

public static function difficultyString():String
{
var guestNumber:Int = 0;
Expand Down
17 changes: 10 additions & 7 deletions source/objects/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,11 @@ class Character extends FunkinSprite
{
AnimName = AnimName.substr(0, AnimName.length - 4);

if (doMissThing)
if (doMissThing){
missed = true;
}
}

if (AnimName.endsWith('miss') && curCharacter == 'bf-sky' && doMissThing)
missed = true;

if (animation.getByName(AnimName) == null) // if it's STILL null, just play idle, and if you REALLY messed up, it'll look in the xml for a valid anim
{
if(danceIdle && animation.getByName('danceRight') != null)
Expand All @@ -600,10 +598,15 @@ class Character extends FunkinSprite

animation.play(AnimName, Force, Reversed, Frame);

if (missed)
color = curColor + 0xFFCFAFFF;
else if (color != curColor && doMissThing)
if (missed){
var realCurColor = curColor;
color = CoolUtil.blendColors(curColor, 0xFFCFAFFF);
curColor = realCurColor;
}
else if (color != curColor && doMissThing){
color = curColor;
}


var daOffset = animOffsets.get(AnimName);

Expand Down
1 change: 1 addition & 0 deletions source/objects/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ class Note extends FlxSprite
function loadNoteAnims(daStyle:String, ?sustainNote:Bool = false)
{
var initialStyle:String = daStyle;
separateSheets = false;

switch (daStyle)
{
Expand Down
18 changes: 11 additions & 7 deletions source/objects/StrumNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class StrumNote extends FlxSprite
public function loadNoteAnims(style:String, ?first:Bool = false)
{
daStyle = style;
separateSheets = false;

var suf:String = "";

Expand Down Expand Up @@ -184,14 +185,13 @@ class StrumNote extends FlxSprite
if (isMania)
frames = Paths.getSparrowAtlas("notes/shaggyNotes");
else{
/*if (Assets.exists(Paths.image("notes/normal/notes_strumline"))){
if (Assets.exists(Paths.image("notes/normal/notes_strumline"))){
separateSheets = true;
frames = Paths.getSparrowAtlas("notes/normal/notes_strumline");
}
else{
frames = Paths.getSparrowAtlas(mania > 0 ? "notes/shaggyNotes" : "notes/NOTE_assets");
}*/
frames = Paths.getSparrowAtlas(mania > 0 ? "notes/shaggyNotes" : "notes/NOTE_assets");
}
}

addAnims();
Expand Down Expand Up @@ -274,9 +274,7 @@ class StrumNote extends FlxSprite
public function postAddedToGroup() {
playAnim("static");
x += Note.swagWidth * noteData;
if(!separateSheets){
x += 50;
}
x += 50;
x += ((FlxG.width / 2) * player);
ID = noteData;
}
Expand Down Expand Up @@ -307,7 +305,13 @@ class StrumNote extends FlxSprite
centerOffsets();
centerOrigin();

if(animation.curAnim.name == "confirm" && !isPixel)
if(animation.curAnim.name == "confirm" && !isPixel){
centerOrigin();
}

if (separateSheets && !isPixel){
offset.x += 32;
offset.y += 20;
}
}
}
1 change: 1 addition & 0 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import openfl.utils.AssetType;
import openfl.events.KeyboardEvent;
import openfl.geom.Matrix;
import openfl.geom.Rectangle;
import openfl.display.Sprite;

import lime.utils.Assets;
import lime.graphics.Image;
Expand Down

0 comments on commit 86d812e

Please sign in to comment.