mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-09 00:04:42 +00:00
Merge branch 'master' of github.com:ninjamuffin99/Funkin-secret into nitpix
This commit is contained in:
commit
80cac358c2
|
@ -1,15 +1,19 @@
|
|||
package;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.util.FlxTimer;
|
||||
import shaderslmfao.ColorSwap;
|
||||
|
||||
using StringTools;
|
||||
|
||||
#if polymod
|
||||
import polymod.format.ParseRules.TargetSignatureElement;
|
||||
#end
|
||||
|
||||
using StringTools;
|
||||
|
||||
class Note extends FlxSprite
|
||||
{
|
||||
public var strumTime:Float = 0;
|
||||
|
@ -82,10 +86,10 @@ class Note extends FlxSprite
|
|||
default:
|
||||
frames = Paths.getSparrowAtlas('NOTE_assets');
|
||||
|
||||
animation.addByPrefix('greenScroll', 'green0');
|
||||
animation.addByPrefix('redScroll', 'red0');
|
||||
animation.addByPrefix('blueScroll', 'blue0');
|
||||
animation.addByPrefix('purpleScroll', 'purple0');
|
||||
animation.addByPrefix('greenScroll', 'green instance');
|
||||
animation.addByPrefix('redScroll', 'red instance');
|
||||
animation.addByPrefix('blueScroll', 'blue instance');
|
||||
animation.addByPrefix('purpleScroll', 'purple instance');
|
||||
|
||||
animation.addByPrefix('purpleholdend', 'pruple end hold');
|
||||
animation.addByPrefix('greenholdend', 'green hold end');
|
||||
|
@ -100,6 +104,17 @@ class Note extends FlxSprite
|
|||
setGraphicSize(Std.int(width * 0.7));
|
||||
updateHitbox();
|
||||
antialiasing = true;
|
||||
|
||||
var colorSwap = new ColorSwap();
|
||||
|
||||
// shader = colorSwap.shader;
|
||||
|
||||
// colorSwap.colorToReplace = 0xFFF9393F;
|
||||
// colorSwap.newColor = 0xFF00FF00;
|
||||
|
||||
// color = FlxG.random.color();
|
||||
// color.saturation *= 4;
|
||||
// replaceColor(0xFFC1C1C1, FlxColor.RED);
|
||||
}
|
||||
|
||||
switch (noteData)
|
||||
|
|
|
@ -1240,22 +1240,22 @@ class PlayState extends MusicBeatState
|
|||
{
|
||||
case 0:
|
||||
babyArrow.x += Note.swagWidth * 0;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 1');
|
||||
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
|
||||
case 1:
|
||||
babyArrow.x += Note.swagWidth * 1;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 2');
|
||||
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
|
||||
case 2:
|
||||
babyArrow.x += Note.swagWidth * 2;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowUP');
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 4');
|
||||
babyArrow.animation.addByPrefix('pressed', 'up press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false);
|
||||
case 3:
|
||||
babyArrow.x += Note.swagWidth * 3;
|
||||
babyArrow.animation.addByPrefix('static', 'arrowRIGHT');
|
||||
babyArrow.animation.addByPrefix('static', 'arrow static instance 3');
|
||||
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
|
||||
babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false);
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@ class TitleState extends MusicBeatState
|
|||
// bg.antialiasing = true;
|
||||
// bg.setGraphicSize(Std.int(bg.width * 0.6));
|
||||
// bg.updateHitbox();
|
||||
|
||||
add(bg);
|
||||
|
||||
logoBl = new FlxSprite(-150, -100);
|
||||
|
@ -146,6 +147,8 @@ class TitleState extends MusicBeatState
|
|||
logoBl.animation.addByPrefix('bump', 'logo bumpin', 24);
|
||||
logoBl.animation.play('bump');
|
||||
logoBl.updateHitbox();
|
||||
|
||||
// trace();
|
||||
// logoBl.screenCenter();
|
||||
// logoBl.color = FlxColor.BLACK;
|
||||
|
||||
|
@ -357,6 +360,7 @@ class TitleState extends MusicBeatState
|
|||
super.beatHit();
|
||||
|
||||
logoBl.animation.play('bump', true);
|
||||
|
||||
danceLeft = !danceLeft;
|
||||
|
||||
if (danceLeft)
|
||||
|
|
90
source/shaderslmfao/ColorSwap.hx
Normal file
90
source/shaderslmfao/ColorSwap.hx
Normal file
|
@ -0,0 +1,90 @@
|
|||
package shaderslmfao;
|
||||
|
||||
import flixel.system.FlxAssets.FlxShader;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
class ColorSwap
|
||||
{
|
||||
public var shader(default, null):ColorSwapShader;
|
||||
public var colorToReplace(default, set):FlxColor;
|
||||
public var newColor(default, set):FlxColor;
|
||||
|
||||
public function new():Void
|
||||
{
|
||||
shader = new ColorSwapShader();
|
||||
shader.colorOld.value = [];
|
||||
shader.colorNew.value = [];
|
||||
}
|
||||
|
||||
function set_colorToReplace(color:FlxColor):FlxColor
|
||||
{
|
||||
colorToReplace = color;
|
||||
|
||||
shader.colorOld.value[0] = color.red;
|
||||
shader.colorOld.value[1] = color.green;
|
||||
shader.colorOld.value[2] = color.blue;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
function set_newColor(color:FlxColor):FlxColor
|
||||
{
|
||||
newColor = color;
|
||||
|
||||
shader.colorNew.value[0] = color.red;
|
||||
shader.colorNew.value[1] = color.green;
|
||||
shader.colorNew.value[2] = color.blue;
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
class ColorSwapShader extends FlxShader
|
||||
{
|
||||
@:glFragmentSource('
|
||||
#pragma header
|
||||
|
||||
uniform vec3 colorOld;
|
||||
uniform vec3 colorNew;
|
||||
uniform float u_time;
|
||||
|
||||
vec3 normalizeColor(vec3 color)
|
||||
{
|
||||
return vec3(
|
||||
color[0] / 255.0,
|
||||
color[1] / 255.0,
|
||||
color[2] / 255.0
|
||||
);
|
||||
}
|
||||
|
||||
vec3 hueShift(vec3 color, float hue) {
|
||||
const vec3 k = vec3(0.57735, 0.57735, 0.57735);
|
||||
float cosAngle = cos(hue);
|
||||
return vec3(color * cosAngle + cross(k, color) * sin(hue) + k * dot(k, color) * (1.0 - cosAngle));
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 pixel = texture2D(bitmap, openfl_TextureCoordv);
|
||||
|
||||
vec3 eps = vec3(0.02, 0.02, 0.02);
|
||||
|
||||
vec3 colorOldNormalized = normalizeColor(colorOld);
|
||||
vec3 colorNewNormalized = normalizeColor(colorNew);
|
||||
|
||||
if (all(greaterThanEqual(pixel, vec4(colorOldNormalized - eps, 1.0)) ) && all(lessThanEqual(pixel, vec4(colorOldNormalized + eps, 1.0)) )
|
||||
)
|
||||
{
|
||||
pixel = vec4(hueShift(colorOldNormalized, 0.7), 1.0);
|
||||
}
|
||||
|
||||
gl_FragColor = pixel;
|
||||
}
|
||||
|
||||
')
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue