Skip to content

Commit

Permalink
added splash screen and nerfed difficulty and some more
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyrid19 committed Feb 6, 2024
1 parent eef22a9 commit 82769a9
Show file tree
Hide file tree
Showing 14 changed files with 239 additions and 52 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/preload/sounds/cancelMenu.ogg
Binary file not shown.
Binary file modified assets/preload/sounds/confirmMenu.ogg
Binary file not shown.
Binary file modified assets/preload/sounds/scrollMenu.ogg
Binary file not shown.
Binary file added assets/videos/joe_mod_intro_video.mp4
Binary file not shown.
Binary file added assets/videos/joe_mod_intro_video_big.mp4
Binary file not shown.
6 changes: 0 additions & 6 deletions example_mods/data/joeseph/script1.lua

This file was deleted.

134 changes: 97 additions & 37 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class FreeplayState extends MusicBeatState
var songCover:FlxSprite;
var songCoverMask:FlxSprite;
var songCoverFinal:FlxSprite;
var diffSprite:FlxSprite;
var arrow1:FlxSprite;
var arrow2:FlxSprite;
var songText:FlxText;
Expand All @@ -56,6 +57,15 @@ class FreeplayState extends MusicBeatState

var tagline:String = '';

public static var availableDiffs:Array<String> = [
'normal',
'nerfed'
];

public static var curDiff:String = '';
var diffSelected:Int = 0;
var songSelected:Bool = false;

private var grpSongs:FlxTypedGroup<Alphabet>;
private var curPlaying:Bool = false;

Expand Down Expand Up @@ -166,6 +176,14 @@ class FreeplayState extends MusicBeatState
FlxSpriteUtil.alphaMaskFlxSprite(songCover, songCoverMask, songCoverFinal);
add(songCoverFinal);

diffSprite = new FlxSprite().loadGraphic(Paths.image('freeplaydifficulties/normal'));
diffSprite.antialiasing = ClientPrefs.globalAntialiasing;
diffSprite.setGraphicSize(Std.int(diffSprite.width * 0.5));
diffSprite.updateHitbox();
diffSprite.screenCenter(X);
diffSprite.y = -300;
add(diffSprite);

tagline = getFreeplayTag();

songText = new FlxText(0, songCover.y + 360, FlxG.width, "", 76);
Expand Down Expand Up @@ -334,26 +352,34 @@ class FreeplayState extends MusicBeatState
{
if (leftP)
{
changeSelection(-shiftMult);
updateSongCoverAndText();
holdTime = 0;
if (!songSelected) {
changeSelection(-shiftMult);
updateSongCoverAndText();
holdTime = 0;

FlxTween.cancelTweensOf(arrow1);
arrow1.x = 0;
FlxTween.tween(arrow1, {x: 20}, 1, {ease: FlxEase.circOut});
FlxTween.cancelTweensOf(arrow1);
arrow1.x = 0;
FlxTween.tween(arrow1, {x: 20}, 1, {ease: FlxEase.circOut});
} else {
changeDiff(-1);
}
}
if (rightP)
{
changeSelection(shiftMult);
updateSongCoverAndText();
holdTime = 0;
if (!songSelected) {
changeSelection(shiftMult);
updateSongCoverAndText();
holdTime = 0;

FlxTween.cancelTweensOf(arrow2);
arrow2.x = FlxG.width - 150;
FlxTween.tween(arrow2, {x: FlxG.width - 170}, 1, {ease: FlxEase.circOut});
FlxTween.cancelTweensOf(arrow2);
arrow2.x = FlxG.width - 150;
FlxTween.tween(arrow2, {x: FlxG.width - 170}, 1, {ease: FlxEase.circOut});
} else {
changeDiff(1);
}
}

if(controls.UI_LEFT || controls.UI_RIGHT)
if((controls.UI_LEFT || controls.UI_RIGHT) && !songSelected)
{
var checkLastHold:Int = Math.floor((holdTime - 0.5) * 10);
holdTime += elapsed;
Expand All @@ -379,7 +405,7 @@ class FreeplayState extends MusicBeatState
}
}

if(FlxG.mouse.wheel != 0 && FlxG.keys.pressed.SHIFT)
if(FlxG.mouse.wheel != 0 && FlxG.keys.pressed.SHIFT && !songSelected)
{
FlxG.sound.play(Paths.sound('scrollMenu'), 0.2);
changeSelection(-1 * FlxG.mouse.wheel, false);
Expand All @@ -389,12 +415,16 @@ class FreeplayState extends MusicBeatState

if (controls.BACK)
{
persistentUpdate = false;
if(colorTween != null) {
colorTween.cancel();
if (!songSelected) {
persistentUpdate = false;
if(colorTween != null) {
colorTween.cancel();
}
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new MainMenuState());
} else {
setDiffSelect(false);
}
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new MainMenuState());
}

if(ctrl)
Expand Down Expand Up @@ -445,28 +475,30 @@ class FreeplayState extends MusicBeatState
trace(poop);

if (sys.FileSystem.exists(Paths.modsJson(songLowercase + '/' + poop)) || sys.FileSystem.exists(Paths.json(songLowercase + '/' + poop))) {

trace(sys.FileSystem.exists(Paths.modsJson(songLowercase + '/' + poop)));

PlayState.SONG = Song.loadFromJson(poop, songLowercase);
PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty;
if (songSelected) {
trace(sys.FileSystem.exists(Paths.modsJson(songLowercase + '/' + poop)));

trace('CURRENT WEEK: ' + WeekData.getWeekFileName());
if(colorTween != null) {
colorTween.cancel();
}

if (FlxG.keys.pressed.SHIFT){
LoadingState.loadAndSwitchState(new ChartingState());
}else{
LoadingState.loadAndSwitchState(new PlayState());
}
PlayState.SONG = Song.loadFromJson(poop, songLowercase);
PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty;

FlxG.sound.music.volume = 0;
trace('CURRENT WEEK: ' + WeekData.getWeekFileName());
if(colorTween != null) {
colorTween.cancel();
}

destroyFreeplayVocals();
if (FlxG.keys.pressed.SHIFT){
LoadingState.loadAndSwitchState(new ChartingState());
}else{
LoadingState.loadAndSwitchState(new PlayState());
}

FlxG.sound.music.volume = 0;

destroyFreeplayVocals();
}

setDiffSelect(true);
} else {
FlxG.sound.play(Paths.sound('cancelMenu'));
FlxTween.cancelTweensOf(errorText);
Expand All @@ -493,6 +525,18 @@ class FreeplayState extends MusicBeatState
vocals = null;
}

function setDiffSelect(selected:Bool = true) {
songSelected = selected;

FlxTween.cancelTweensOf(diffSprite);

if (selected == true) {
FlxTween.tween(diffSprite, {y: 35}, 0.7, {ease: FlxEase.backOut});
} else {
FlxTween.tween(diffSprite, {y: -300}, 0.7, {ease: FlxEase.backIn});
}
}

function getFreeplayTag():String //stolen from title text..
{
var taglist:Array<String> = CoolUtil.coolTextFile(Paths.txt('freeplayText'));
Expand Down Expand Up @@ -522,6 +566,22 @@ class FreeplayState extends MusicBeatState
FlxSpriteUtil.alphaMaskFlxSprite(songCover, songCoverMask, songCoverFinal);
}

function changeDiff(change:Int = 0, playSound:Bool = true)
{
if(playSound) FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);

diffSelected += change;

if (diffSelected < 0)
diffSelected = availableDiffs.length - 1;
if (diffSelected >= availableDiffs.length)
diffSelected = 0;

curDiff = availableDiffs[diffSelected];
diffSprite.loadGraphic(Paths.image('freeplaydifficulties/' + curDiff));
trace(curDiff);
}

function changeSelection(change:Int = 0, playSound:Bool = true)
{
if(playSound) FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
Expand Down
2 changes: 1 addition & 1 deletion source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Main extends Sprite
{
var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom).
var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).
var initialState:Class<FlxState> = TitleState; // The FlxState the game starts with.
var initialState:Class<FlxState> = SplashState; // The FlxState the game starts with.
var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
var framerate:Int = 60; // How many frames per second the game should run at.
var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
Expand Down
13 changes: 13 additions & 0 deletions source/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class MainMenuState extends MusicBeatState
#end
WeekData.loadTheFirstEnabledMod();

FlxG.mouse.visible = true;

#if desktop
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null);
Expand Down Expand Up @@ -253,6 +255,11 @@ class MainMenuState extends MusicBeatState
{
CoolUtil.browserLoad('https://ninja-muffin24.itch.io/funkin');
}
else if (optionShit[curSelected] == 'story_mode')
{
FlxG.camera.shake(0.01, 0.1);
FlxG.sound.play(Paths.sound('cancelMenu'));
}
else
{
selectedSomethin = true;
Expand Down Expand Up @@ -333,6 +340,12 @@ class MainMenuState extends MusicBeatState
{
//spr.screenCenter(X);
//spr.x = 20;

if (spr.ID == 0) {
spr.color = 0xBBBBBB;
} else {
spr.color = 0xFFFFFF;
}
});
}

Expand Down
26 changes: 21 additions & 5 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,9 @@ class PlayState extends MusicBeatState
healthBarBG.visible = !ClientPrefs.hideHud;
healthBarBG.xAdd = -4;
healthBarBG.yAdd = -4;
add(healthBarBG);
if (FreeplayState.curDiff != 'nerfed') {
add(healthBarBG);
}
if(ClientPrefs.downScroll) healthBarBG.y = 0.11 * FlxG.height;

healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this,
Expand All @@ -1200,8 +1202,10 @@ class PlayState extends MusicBeatState
// healthBar
healthBar.visible = !ClientPrefs.hideHud;
healthBar.alpha = ClientPrefs.healthBarAlpha;
add(healthBar);
healthBarBG.sprTracker = healthBar;
if (FreeplayState.curDiff != 'nerfed') {
add(healthBar);
healthBarBG.sprTracker = healthBar;
}

iconP1 = new HealthIcon(boyfriend.healthIcon, true);
iconP1.y = healthBar.y - 75;
Expand Down Expand Up @@ -3110,8 +3114,13 @@ class PlayState extends MusicBeatState

var iconOffset:Int = 26;

iconP1.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) + (150 * iconP1.scale.x - 150) / 2 - iconOffset;
iconP2.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (150 * iconP2.scale.x) / 2 - iconOffset * 2;
if (FreeplayState.curDiff != 'nerfed') {
iconP1.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) + (150 * iconP1.scale.x - 150) / 2 - iconOffset;
iconP2.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (150 * iconP2.scale.x) / 2 - iconOffset * 2;
} else if (FreeplayState.curDiff == 'nerfed') {
iconP1.x = FlxG.width - 500;
iconP2.x = 350;
}

if (health > 2)
health = 2;
Expand Down Expand Up @@ -3144,6 +3153,13 @@ class PlayState extends MusicBeatState
iconP2.animation.curAnim.curFrame = 0;
}

if (FreeplayState.curDiff == 'nerfed') {
health = 1;

iconP1.animation.curAnim.curFrame = 0;
iconP2.animation.curAnim.curFrame = 0;
}

if (FlxG.keys.anyJustPressed(debugKeysCharacter) && !endingSong && !inCutscene) {
persistentUpdate = false;
paused = true;
Expand Down
Loading

0 comments on commit 82769a9

Please sign in to comment.