Skip to content

Commit

Permalink
unfairj stage lol
Browse files Browse the repository at this point in the history
  • Loading branch information
x8c8r committed Jul 19, 2024
1 parent 5fcbf51 commit 9140252
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 109 deletions.
2 changes: 2 additions & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@

<haxedef name='no-deprecation-warnings' />

<haxedef name='SHADERS_ENABLED' if="desktop"/>

<!-- _________________________________ Custom _______________________________ -->

<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
Expand Down
67 changes: 3 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,74 +38,13 @@ Basically character editor, but for stages, idk what to say lmao

This is a **MOD**. This is not Vanilla and should be treated as a **MODIFICATION**. This will probably never be official, so dont get confused.

## Credits / shoutouts
## Acknowledging stolen code

- [ninjamuffin99 (me!)](https://twitter.com/ninja_muffin99) - Programmer
- [PhantomArcade3K](https://twitter.com/phantomarcade3k) and [Evilsk8r](https://twitter.com/evilsk8r) - Art
- [Kawaisprite](https://twitter.com/kawaisprite) - Musician

This game was made with love to Newgrounds and it's community. Extra love to Tom Fulp.

## Build instructions

THESE INSTRUCTIONS ARE FOR COMPILING THE GAME'S SOURCE CODE!!!

IF YOU WANT TO JUST DOWNLOAD AND INSTALL AND PLAY THE GAME NORMALLY, GO TO ITCH.IO TO DOWNLOAD THE GAME FOR PC, MAC, AND LINUX!!

https://ninja-muffin24.itch.io/friday-night-funkin

IF YOU WANT TO COMPILE THE GAME YOURSELF, CONTINUE READING!!!

### Installing the Required Programs

First you need to install Haxe and HaxeFlixel. I'm too lazy to write and keep updated with that setup (which is pretty simple).
1. [Install Haxe 4.1.5](https://haxe.org/download/version/4.1.5/) (Download 4.1.5 instead of 4.2.0 because 4.2.0 is broken and is not working with gits properly...)
2. [Install HaxeFlixel](https://haxeflixel.com/documentation/install-haxeflixel/) after downloading Haxe

Other installations you'd need is the additional libraries, a fully updated list will be in `Project.xml` in the project root. Currently, these are all of the things you need to install:
```
flixel
flixel-addons
flixel-ui
hscript
newgrounds
```
So for each of those type `haxelib install [library]` so shit like `haxelib install newgrounds`

You'll also need to install polymod. To do this, you need to do a few things first.
1. Download [git-scm](https://git-scm.com/downloads). Works for Windows, Mac, and Linux, just select your build.
2. Follow instructions to install the application properly.
3. Run `haxelib git polymod https://github.com/larsiusprime/polymod.git` in terminal/command-prompt after your git program is installed.

You should have everything ready for compiling the game! Follow the guide below to continue!

At the moment, you can optionally fix the transition bug in songs with zoomed out cameras.
- Run `haxelib git flixel-addons https://github.com/HaxeFlixel/flixel-addons` in the terminal/command-prompt.

### Ignored files

I gitignore the API keys for the game, so that no one can nab them and post fake highscores on the leaderboards. But because of that the game
doesn't compile without it.

Just make a file in `/source` and call it `APIStuff.hx`, and copy paste this into it

```haxe
package;
class APIStuff
{
public static var API:String = "";
public static var EncKey:String = "";
}
```

and you should be good to go there.
[DNB Background Generator](https://github.com/silkycell/DNB-Background-Generator) - The shader code (shaders come from [Vs. Dave and Bambi](https://gamebanana.com/mods/43201))
[Psych Engine](https://github.com/ShadowMario/FNF-PsychEngine) - Alphabet, Setup files, and other shit I prob wouldn't be able to remember.

### Compiling game

Once you have all those installed, it's pretty easy to compile the game. You just need to run 'lime test html5 -debug' in the root of the project to build and run the HTML5 version. (command prompt navigation guide can be found here: [https://ninjamuffin99.newgrounds.com/news/post/1090480](https://ninjamuffin99.newgrounds.com/news/post/1090480))

To run it from your desktop (Windows, Mac, Linux) it can be a bit more involved. For Linux, you only need to open a terminal in the project directory and run 'lime test linux -debug' and then run the executible file in export/release/linux/bin. For Windows, you need to install Visual Studio Community 2019. While installing VSC, don't click on any of the options to install workloads. Instead, go to the individual components tab and choose the following:
* MSVC v142 - VS 2019 C++ x64/x86 build tools
* Windows SDK (10.0.17763.0)
Expand Down
3 changes: 2 additions & 1 deletion assets/preload/data/stageList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ school
schoolEvil
exe
bopcity
fnaf
fnaf
ikea
Binary file added assets/shared/images/stages/ikea/jo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
110 changes: 110 additions & 0 deletions source/DNBShader.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package;

import flixel.system.FlxAssets.FlxShader;

/* VS DAVE AND BAMBI SHADERS IMPLEMENTATION
ALL OF THIS CODE WAS WROTE BY MTM101, ERIZUR AND T5MPLER (BUGFIXES)
*/

class GlitchEffect
{
public var shader(default,null):GlitchShader = new GlitchShader();

#if SHADERS_ENABLED
public var waveSpeed(default, set):Float = 0;
public var waveFrequency(default, set):Float = 0;
public var waveAmplitude(default, set):Float = 0;
public var Enabled(default, set):Bool = true;

public function new():Void
{
shader.uTime.value = [0];
}

public function update(elapsed:Float):Void
{
shader.uTime.value[0] += elapsed;
}

function set_waveSpeed(v:Float):Float
{
waveSpeed = v;
shader.uSpeed.value = [waveSpeed];
return v;
}
function set_Enabled(v:Bool):Bool
{
Enabled = v;
shader.uEnabled.value = [Enabled];
return v;
}

function set_waveFrequency(v:Float):Float
{
waveFrequency = v;
shader.uFrequency.value = [waveFrequency];
return v;
}

function set_waveAmplitude(v:Float):Float
{
waveAmplitude = v;
shader.uWaveAmplitude.value = [waveAmplitude];
return v;
}
#end
}


class GlitchShader extends FlxShader
{
#if SHADERS_ENABLED
@:glFragmentSource('
#pragma header
//uniform float tx, ty; // x,y waves phase

//modified version of the wave shader to create weird garbled corruption like messes
uniform float uTime;
/**
* How fast the waves move over time
*/
uniform float uSpeed;
/**
* Number of waves over time
*/
uniform float uFrequency;

uniform bool uEnabled;
/**
* How much the pixels are going to stretch over the waves
*/
uniform float uWaveAmplitude;

vec2 sineWave(vec2 pt)
{
float x = 0.0;
float y = 0.0;
float offsetX = sin(pt.y * uFrequency + uTime * uSpeed) * (uWaveAmplitude / pt.x * pt.y);
float offsetY = sin(pt.x * uFrequency - uTime * uSpeed) * (uWaveAmplitude / pt.y * pt.x);
pt.x += offsetX; // * (pt.y - 1.0); // <- Uncomment to stop bottom part of the screen from moving
pt.y += offsetY;

return vec2(pt.x + x, pt.y + y);
}

void main()
{
vec2 uv = sineWave(openfl_TextureCoordv);
gl_FragColor = texture2D(bitmap, uv);
}')
#end

public function new()
{
super();
}
}
64 changes: 20 additions & 44 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package;

import DNBShader.GlitchEffect;
import openfl.Vector;
import lime.math.Vector2;
import ResultsSubState.FunkinResults;
Expand Down Expand Up @@ -162,6 +163,7 @@ class PlayState extends MusicBeatState

var bgGirls:BackgroundGirls;
var wiggleShit:WiggleEffect = new WiggleEffect();
var unfairjShader:GlitchEffect;

var talking:Bool = true;
var songScore:Int = 0;
Expand Down Expand Up @@ -196,7 +198,8 @@ class PlayState extends MusicBeatState
"schoolEvil" => 6,
"exe" => 1,
"bopcity" => 1,
"fnaf" => 1
"fnaf" => 1,
"ikea" => 1
];

var songTimer:SongTimer;
Expand Down Expand Up @@ -788,49 +791,19 @@ class PlayState extends MusicBeatState
bg.active = false;
add(bg);
}
/*
var bg:FlxSprite = new FlxSprite(posX, posY).loadGraphic(Paths.image('weeb/evilSchoolBG'));
bg.scale.set(6, 6);
// bg.setGraphicSize(Std.int(bg.width * 6));
// bg.updateHitbox();
add(bg);
var fg:FlxSprite = new FlxSprite(posX, posY).loadGraphic(Paths.image('weeb/evilSchoolFG'));
fg.scale.set(6, 6);
// fg.setGraphicSize(Std.int(fg.width * 6));
// fg.updateHitbox();
add(fg);
wiggleShit.effectType = WiggleEffectType.DREAMY;
wiggleShit.waveAmplitude = 0.01;
wiggleShit.waveFrequency = 60;
wiggleShit.waveSpeed = 0.8;
*/

// bg.shader = wiggleShit.shader;
// fg.shader = wiggleShit.shader;

/*
var waveSprite = new FlxEffectSprite(bg, [waveEffectBG]);
var waveSpriteFG = new FlxEffectSprite(fg, [waveEffectFG]);
// Using scale since setGraphicSize() doesnt work???
waveSprite.scale.set(6, 6);
waveSpriteFG.scale.set(6, 6);
waveSprite.setPosition(posX, posY);
waveSpriteFG.setPosition(posX, posY);
waveSprite.scrollFactor.set(0.7, 0.8);
waveSpriteFG.scrollFactor.set(0.9, 0.8);
// waveSprite.setGraphicSize(Std.int(waveSprite.width * 6));
// waveSprite.updateHitbox();
// waveSpriteFG.setGraphicSize(Std.int(fg.width * 6));
// waveSpriteFG.updateHitbox();
add(waveSprite);
add(waveSpriteFG);
*/
else if (SONG.stage == "ikea") {
// Code completely stolen from https://github.com/silkycell/DNB-Background-Generator
unfairjShader = new GlitchEffect();
unfairjShader.waveAmplitude = 0.1;
unfairjShader.waveFrequency = 5;
unfairjShader.waveSpeed = 1;

var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stages/ikea/jo'));
bg.antialiasing = false;
bg.shader = unfairjShader.shader;
bg.scrollFactor.set(0.9, 0.9);
add(bg);
}
else
{
defaultCamZoom = 0.9;
Expand Down Expand Up @@ -1763,6 +1736,9 @@ class PlayState extends MusicBeatState
perfectMode = false;
#end

if (unfairjShader != null)
unfairjShader.update(elapsed);

if (FlxG.keys.justPressed.NINE)
{
if (iconP1.animation.curAnim.name == 'bf-old')
Expand Down

0 comments on commit 9140252

Please sign in to comment.