Inital Kade Engine Commit
This commit is contained in:
parent
d3cd2e21c8
commit
6ce80b1c5b
@ -498,22 +498,21 @@ class Controls extends FlxActionSet
|
||||
switch (scheme)
|
||||
{
|
||||
case Solo:
|
||||
inline bindKeys(Control.UP, [W, FlxKey.UP]);
|
||||
inline bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
|
||||
inline bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
|
||||
inline bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
|
||||
inline bindKeys(Control.UP, [J, FlxKey.UP]);
|
||||
inline bindKeys(Control.DOWN, [F, FlxKey.DOWN]);
|
||||
inline bindKeys(Control.LEFT, [D, FlxKey.LEFT]);
|
||||
inline bindKeys(Control.RIGHT, [K, FlxKey.RIGHT]);
|
||||
inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
|
||||
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
||||
inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
|
||||
inline bindKeys(Control.RESET, [R]);
|
||||
case Duo(true):
|
||||
inline bindKeys(Control.UP, [W]);
|
||||
inline bindKeys(Control.DOWN, [S]);
|
||||
inline bindKeys(Control.LEFT, [A]);
|
||||
inline bindKeys(Control.RIGHT, [D]);
|
||||
inline bindKeys(Control.ACCEPT, [G, Z]);
|
||||
inline bindKeys(Control.BACK, [H, X]);
|
||||
inline bindKeys(Control.PAUSE, [ONE]);
|
||||
inline bindKeys(Control.UP, [W, FlxKey.UP]);
|
||||
inline bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
|
||||
inline bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
|
||||
inline bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
|
||||
inline bindKeys(Control.ACCEPT, [G, Z, SPACE, ENTER]);
|
||||
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
|
||||
inline bindKeys(Control.RESET, [R]);
|
||||
case Duo(false):
|
||||
inline bindKeys(Control.UP, [FlxKey.UP]);
|
||||
|
@ -25,6 +25,18 @@ class CoolUtil
|
||||
return daList;
|
||||
}
|
||||
|
||||
public static function coolStringFile(path:String):Array<String>
|
||||
{
|
||||
var daList:Array<String> = path.trim().split('\n');
|
||||
|
||||
for (i in 0...daList.length)
|
||||
{
|
||||
daList[i] = daList[i].trim();
|
||||
}
|
||||
|
||||
return daList;
|
||||
}
|
||||
|
||||
public static function numberArray(max:Int, ?min = 0):Array<Int>
|
||||
{
|
||||
var dumbArray:Array<Int> = [];
|
||||
|
@ -53,22 +53,13 @@ class FreeplayState extends MusicBeatState
|
||||
isDebug = true;
|
||||
#end
|
||||
|
||||
if (StoryMenuState.weekUnlocked[2] || isDebug)
|
||||
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
|
||||
|
||||
if (StoryMenuState.weekUnlocked[2] || isDebug)
|
||||
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
|
||||
|
||||
if (StoryMenuState.weekUnlocked[3] || isDebug)
|
||||
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
|
||||
|
||||
if (StoryMenuState.weekUnlocked[4] || isDebug)
|
||||
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
|
||||
|
||||
if (StoryMenuState.weekUnlocked[5] || isDebug)
|
||||
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
|
||||
|
||||
if (StoryMenuState.weekUnlocked[6] || isDebug)
|
||||
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
|
||||
|
||||
// LOAD MUSIC
|
||||
@ -250,7 +241,7 @@ class FreeplayState extends MusicBeatState
|
||||
function changeSelection(change:Int = 0)
|
||||
{
|
||||
#if !switch
|
||||
NGio.logEvent('Fresh');
|
||||
// NGio.logEvent('Fresh');
|
||||
#end
|
||||
|
||||
// NGio.logEvent('Fresh');
|
||||
|
201
source/LoadReplayState.hx
Normal file
201
source/LoadReplayState.hx
Normal file
@ -0,0 +1,201 @@
|
||||
package;
|
||||
|
||||
import Controls.KeyboardScheme;
|
||||
import Controls.Control;
|
||||
import flash.text.TextField;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.addons.display.FlxGridOverlay;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.util.FlxColor;
|
||||
import lime.utils.Assets;
|
||||
#if sys
|
||||
import sys.io.File;
|
||||
#end
|
||||
|
||||
class LoadReplayState extends MusicBeatState
|
||||
{
|
||||
var selector:FlxText;
|
||||
var curSelected:Int = 0;
|
||||
|
||||
var songs:Array<FreeplayState.SongMetadata> = [];
|
||||
|
||||
var controlsStrings:Array<String> = [];
|
||||
var actualNames:Array<String> = [];
|
||||
|
||||
private var grpControls:FlxTypedGroup<Alphabet>;
|
||||
var versionShit:FlxText;
|
||||
var poggerDetails:FlxText;
|
||||
override function create()
|
||||
{
|
||||
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
||||
#if sys
|
||||
controlsStrings = sys.FileSystem.readDirectory(Sys.getCwd() + "\\assets\\replays\\");
|
||||
#end
|
||||
trace(controlsStrings);
|
||||
|
||||
controlsStrings.sort(Reflect.compare);
|
||||
|
||||
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
|
||||
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
|
||||
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
|
||||
|
||||
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
|
||||
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
|
||||
|
||||
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
|
||||
|
||||
|
||||
for(i in 0...controlsStrings.length)
|
||||
{
|
||||
var string:String = controlsStrings[i];
|
||||
actualNames[i] = string;
|
||||
var rep:Replay = Replay.LoadReplay(string);
|
||||
controlsStrings[i] = string.split("time")[0] + " " + (rep.replay.songDiff == 2 ? "HARD" : rep.replay.songDiff == 1 ? "EASY" : "NORMAL");
|
||||
}
|
||||
|
||||
if (controlsStrings.length == 0)
|
||||
controlsStrings.push("No Replays...");
|
||||
|
||||
menuBG.color = 0xFFea71fd;
|
||||
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
||||
menuBG.updateHitbox();
|
||||
menuBG.screenCenter();
|
||||
menuBG.antialiasing = true;
|
||||
add(menuBG);
|
||||
|
||||
grpControls = new FlxTypedGroup<Alphabet>();
|
||||
add(grpControls);
|
||||
|
||||
for (i in 0...controlsStrings.length)
|
||||
{
|
||||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i], true, false);
|
||||
controlLabel.isMenuItem = true;
|
||||
controlLabel.targetY = i;
|
||||
grpControls.add(controlLabel);
|
||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||
}
|
||||
|
||||
|
||||
versionShit = new FlxText(5, FlxG.height - 34, 0, "Replay Loader (ESCAPE TO GO BACK)\nNOTICE!!!! Replays are in a beta stage, and they are probably not 100% correct. expect misses and other stuff that isn't there!", 12);
|
||||
versionShit.scrollFactor.set();
|
||||
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||
add(versionShit);
|
||||
|
||||
|
||||
poggerDetails = new FlxText(5, 34, 0, "Replay Details - \nnone", 12);
|
||||
poggerDetails.scrollFactor.set();
|
||||
poggerDetails.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||
add(poggerDetails);
|
||||
|
||||
changeSelection(0);
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
public function getWeekNumbFromSong(songName:String):Int
|
||||
{
|
||||
var week:Int = 0;
|
||||
for (i in 0...songs.length)
|
||||
{
|
||||
var pog:FreeplayState.SongMetadata = songs[i];
|
||||
if (pog.songName.toLowerCase() == songName)
|
||||
week = pog.week;
|
||||
}
|
||||
return week;
|
||||
}
|
||||
|
||||
public function addSong(songName:String, weekNum:Int, songCharacter:String)
|
||||
{
|
||||
songs.push(new FreeplayState.SongMetadata(songName, weekNum, songCharacter));
|
||||
}
|
||||
|
||||
public function addWeek(songs:Array<String>, weekNum:Int, ?songCharacters:Array<String>)
|
||||
{
|
||||
if (songCharacters == null)
|
||||
songCharacters = ['bf'];
|
||||
|
||||
var num:Int = 0;
|
||||
for (song in songs)
|
||||
{
|
||||
addSong(song, weekNum, songCharacters[num]);
|
||||
|
||||
if (songCharacters.length != 1)
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
|
||||
if (controls.BACK)
|
||||
FlxG.switchState(new OptionsMenu());
|
||||
if (controls.UP_P)
|
||||
changeSelection(-1);
|
||||
if (controls.DOWN_P)
|
||||
changeSelection(1);
|
||||
|
||||
|
||||
if (controls.ACCEPT && grpControls.members[curSelected].text != "No Replays...")
|
||||
{
|
||||
trace('loading ' + actualNames[curSelected]);
|
||||
PlayState.rep = Replay.LoadReplay(actualNames[curSelected]);
|
||||
|
||||
PlayState.loadRep = true;
|
||||
|
||||
var poop:String = Highscore.formatSong(PlayState.rep.replay.songName.toLowerCase(), PlayState.rep.replay.songDiff);
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName.toLowerCase());
|
||||
PlayState.isStoryMode = false;
|
||||
PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
|
||||
PlayState.storyWeek = getWeekNumbFromSong(PlayState.rep.replay.songName);
|
||||
LoadingState.loadAndSwitchState(new PlayState());
|
||||
}
|
||||
}
|
||||
|
||||
var isSettingControl:Bool = false;
|
||||
|
||||
function changeSelection(change:Int = 0)
|
||||
{
|
||||
#if !switch
|
||||
// NGio.logEvent('Fresh');
|
||||
#end
|
||||
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
||||
|
||||
curSelected += change;
|
||||
|
||||
if (curSelected < 0)
|
||||
curSelected = grpControls.length - 1;
|
||||
if (curSelected >= grpControls.length)
|
||||
curSelected = 0;
|
||||
|
||||
var rep:Replay = Replay.LoadReplay(actualNames[curSelected]);
|
||||
|
||||
poggerDetails.text = "Replay Details - \nDate Created: " + rep.replay.timestamp + "\nSong: " + rep.replay.songName + "\nReplay Version: " + (rep.replay.replayGameVer != Replay.version ? "OUTDATED" : "Latest");
|
||||
|
||||
// selector.y = (70 * curSelected) + 30;
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
for (item in grpControls.members)
|
||||
{
|
||||
item.targetY = bullShit - curSelected;
|
||||
bullShit++;
|
||||
|
||||
item.alpha = 0.6;
|
||||
// item.setGraphicSize(Std.int(item.width * 0.8));
|
||||
|
||||
if (item.targetY == 0)
|
||||
{
|
||||
item.alpha = 1;
|
||||
// item.setGraphicSize(Std.int(item.width));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ class Main extends Sprite
|
||||
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 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 framerate:Int = 120; // 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.
|
||||
var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets
|
||||
|
||||
|
@ -3,7 +3,6 @@ package;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxObject;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.effects.FlxFlicker;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
@ -28,14 +27,18 @@ class MainMenuState extends MusicBeatState
|
||||
var optionShit:Array<String> = ['story mode', 'freeplay'];
|
||||
#end
|
||||
|
||||
var newGaming:FlxText;
|
||||
var newGaming2:FlxText;
|
||||
var newInput:Bool = true;
|
||||
|
||||
public static var kadeEngineVer:String = "1.0";
|
||||
public static var gameVer:String = "0.2.7.1";
|
||||
|
||||
var magenta:FlxSprite;
|
||||
var camFollow:FlxObject;
|
||||
|
||||
override function create()
|
||||
{
|
||||
transIn = FlxTransitionableState.defaultTransIn;
|
||||
transOut = FlxTransitionableState.defaultTransOut;
|
||||
|
||||
if (!FlxG.sound.music.playing)
|
||||
{
|
||||
FlxG.sound.playMusic(Paths.music('freakyMenu'));
|
||||
@ -88,13 +91,14 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
FlxG.camera.follow(camFollow, null, 0.06);
|
||||
|
||||
var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, "v" + Application.current.meta.get('version'), 12);
|
||||
var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, gameVer + " FNF - " + kadeEngineVer + " Kade Engine", 12);
|
||||
versionShit.scrollFactor.set();
|
||||
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||
add(versionShit);
|
||||
|
||||
// NG.core.calls.event.logEvent('swag').send();
|
||||
|
||||
|
||||
changeItem();
|
||||
|
||||
super.create();
|
||||
@ -149,7 +153,7 @@ class MainMenuState extends MusicBeatState
|
||||
{
|
||||
if (curSelected != spr.ID)
|
||||
{
|
||||
FlxTween.tween(spr, {alpha: 0}, 0.4, {
|
||||
FlxTween.tween(spr, {alpha: 0}, 1.3, {
|
||||
ease: FlxEase.quadOut,
|
||||
onComplete: function(twn:FlxTween)
|
||||
{
|
||||
@ -174,8 +178,6 @@ class MainMenuState extends MusicBeatState
|
||||
trace("Freeplay Menu Selected");
|
||||
|
||||
case 'options':
|
||||
FlxTransitionableState.skipNextTransIn = true;
|
||||
FlxTransitionableState.skipNextTransOut = true;
|
||||
FlxG.switchState(new OptionsMenu());
|
||||
}
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import Controls.KeyboardScheme;
|
||||
import Controls.Control;
|
||||
import flash.text.TextField;
|
||||
import flixel.FlxG;
|
||||
@ -20,11 +21,23 @@ class OptionsMenu extends MusicBeatState
|
||||
var controlsStrings:Array<String> = [];
|
||||
|
||||
private var grpControls:FlxTypedGroup<Alphabet>;
|
||||
|
||||
var versionShit:FlxText;
|
||||
override function create()
|
||||
{
|
||||
if (FlxG.save.data.newInput == null)
|
||||
FlxG.save.data.newInput = true;
|
||||
|
||||
if (FlxG.save.data.downscroll == null)
|
||||
FlxG.save.data.downscroll = false;
|
||||
|
||||
if (FlxG.save.data.dfjk == null)
|
||||
FlxG.save.data.dfjk = false;
|
||||
|
||||
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
||||
controlsStrings = CoolUtil.coolTextFile(Paths.txt('controls'));
|
||||
controlsStrings = CoolUtil.coolStringFile((FlxG.save.data.dfjk ? 'DFJK' : 'WASD') + "\n" + (FlxG.save.data.newInput ? "New input" : "Old Input") + "\n" + (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll') + "\nLoad replays");
|
||||
|
||||
trace(controlsStrings);
|
||||
|
||||
menuBG.color = 0xFFea71fd;
|
||||
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
||||
menuBG.updateHitbox();
|
||||
@ -32,75 +45,93 @@ class OptionsMenu extends MusicBeatState
|
||||
menuBG.antialiasing = true;
|
||||
add(menuBG);
|
||||
|
||||
/*
|
||||
grpControls = new FlxTypedGroup<Alphabet>();
|
||||
add(grpControls);
|
||||
|
||||
for (i in 0...controlsStrings.length)
|
||||
{
|
||||
if (controlsStrings[i].indexOf('set') != -1)
|
||||
{
|
||||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i].substring(3) + ': ' + controlsStrings[i + 1], true, false);
|
||||
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i], true, false);
|
||||
controlLabel.isMenuItem = true;
|
||||
controlLabel.targetY = i;
|
||||
grpControls.add(controlLabel);
|
||||
}
|
||||
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
versionShit = new FlxText(5, FlxG.height - 18, 0, "Offset (Left, Right): " + FlxG.save.data.offset, 12);
|
||||
versionShit.scrollFactor.set();
|
||||
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||
add(versionShit);
|
||||
|
||||
super.create();
|
||||
|
||||
openSubState(new OptionsSubState());
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
|
||||
/*
|
||||
if (controls.ACCEPT)
|
||||
{
|
||||
changeBinding();
|
||||
}
|
||||
|
||||
if (isSettingControl)
|
||||
waitingInput();
|
||||
else
|
||||
{
|
||||
if (controls.BACK)
|
||||
FlxG.switchState(new MainMenuState());
|
||||
if (controls.UP_P)
|
||||
changeSelection(-1);
|
||||
if (controls.DOWN_P)
|
||||
changeSelection(1);
|
||||
}
|
||||
*/
|
||||
|
||||
if (controls.RIGHT_R)
|
||||
{
|
||||
FlxG.save.data.offset++;
|
||||
versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset;
|
||||
}
|
||||
|
||||
function waitingInput():Void
|
||||
if (controls.LEFT_R)
|
||||
{
|
||||
if (FlxG.keys.getIsDown().length > 0)
|
||||
{
|
||||
PlayerSettings.player1.controls.replaceBinding(Control.LEFT, Keys, FlxG.keys.getIsDown()[0].ID, null);
|
||||
FlxG.save.data.offset--;
|
||||
versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset;
|
||||
}
|
||||
|
||||
|
||||
if (controls.ACCEPT)
|
||||
{
|
||||
if (curSelected != 3)
|
||||
grpControls.remove(grpControls.members[curSelected]);
|
||||
switch(curSelected)
|
||||
{
|
||||
case 0:
|
||||
FlxG.save.data.dfjk = !FlxG.save.data.dfjk;
|
||||
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.dfjk ? 'DFJK' : 'WASD'), true, false);
|
||||
ctrl.isMenuItem = true;
|
||||
ctrl.targetY = curSelected;
|
||||
grpControls.add(ctrl);
|
||||
if (FlxG.save.data.dfjk)
|
||||
controls.setKeyboardScheme(KeyboardScheme.Solo, true);
|
||||
else
|
||||
controls.setKeyboardScheme(KeyboardScheme.Duo(true), true);
|
||||
|
||||
case 1:
|
||||
FlxG.save.data.newInput = !FlxG.save.data.newInput;
|
||||
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.newInput ? "New input" : "Old Input"), true, false);
|
||||
ctrl.isMenuItem = true;
|
||||
ctrl.targetY = curSelected - 1;
|
||||
grpControls.add(ctrl);
|
||||
case 2:
|
||||
FlxG.save.data.downscroll = !FlxG.save.data.downscroll;
|
||||
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll'), true, false);
|
||||
ctrl.isMenuItem = true;
|
||||
ctrl.targetY = curSelected - 2;
|
||||
grpControls.add(ctrl);
|
||||
case 3:
|
||||
trace('switch');
|
||||
FlxG.switchState(new LoadReplayState());
|
||||
}
|
||||
}
|
||||
// PlayerSettings.player1.controls.replaceBinding(Control)
|
||||
}
|
||||
|
||||
var isSettingControl:Bool = false;
|
||||
|
||||
function changeBinding():Void
|
||||
{
|
||||
if (!isSettingControl)
|
||||
{
|
||||
isSettingControl = true;
|
||||
}
|
||||
}
|
||||
|
||||
function changeSelection(change:Int = 0)
|
||||
{
|
||||
#if !switch
|
||||
NGio.logEvent('Fresh');
|
||||
// NGio.logEvent('Fresh');
|
||||
#end
|
||||
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
||||
|
@ -49,6 +49,14 @@ class PlayState extends MusicBeatState
|
||||
public static var storyWeek:Int = 0;
|
||||
public static var storyPlaylist:Array<String> = [];
|
||||
public static var storyDifficulty:Int = 1;
|
||||
public static var weekSong:Int = 0;
|
||||
public static var shits:Int = 0;
|
||||
public static var bads:Int = 0;
|
||||
public static var goods:Int = 0;
|
||||
public static var sicks:Int = 0;
|
||||
|
||||
public static var rep:Replay;
|
||||
public static var loadRep:Bool = false;
|
||||
|
||||
var halloweenLevel:Bool = false;
|
||||
|
||||
@ -77,6 +85,12 @@ class PlayState extends MusicBeatState
|
||||
private var gfSpeed:Int = 1;
|
||||
private var health:Float = 1;
|
||||
private var combo:Int = 0;
|
||||
public static var misses:Int = 0;
|
||||
private var accuracy:Float = 0.00;
|
||||
private var totalNotesHit:Float = 0;
|
||||
private var totalPlayed:Int = 0;
|
||||
private var ss:Bool = false;
|
||||
|
||||
|
||||
private var healthBarBG:FlxSprite;
|
||||
private var healthBar:FlxBar;
|
||||
@ -106,28 +120,44 @@ class PlayState extends MusicBeatState
|
||||
var bottomBoppers:FlxSprite;
|
||||
var santa:FlxSprite;
|
||||
|
||||
var fc:Bool = true;
|
||||
|
||||
var bgGirls:BackgroundGirls;
|
||||
var wiggleShit:WiggleEffect = new WiggleEffect();
|
||||
|
||||
var talking:Bool = true;
|
||||
var songScore:Int = 0;
|
||||
var scoreTxt:FlxText;
|
||||
var replayTxt:FlxText;
|
||||
|
||||
|
||||
public static var campaignScore:Int = 0;
|
||||
|
||||
var defaultCamZoom:Float = 1.05;
|
||||
|
||||
// how big to stretch the pixel art assets
|
||||
public static var daPixelZoom:Float = 6;
|
||||
|
||||
public static var theFunne:Bool = true;
|
||||
var funneEffect:FlxSprite;
|
||||
var inCutscene:Bool = false;
|
||||
public static var repPresses:Int = 0;
|
||||
public static var repReleases:Int = 0;
|
||||
|
||||
public static var timeCurrently:Float = 0;
|
||||
public static var timeCurrentlyR:Float = 0;
|
||||
|
||||
override public function create()
|
||||
{
|
||||
|
||||
theFunne = FlxG.save.data.newInput;
|
||||
if (FlxG.sound.music != null)
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
sicks = 0;
|
||||
bads = 0;
|
||||
shits = 0;
|
||||
goods = 0;
|
||||
|
||||
// var gameCam:FlxCamera = FlxG.camera;
|
||||
camGame = new FlxCamera();
|
||||
camHUD = new FlxCamera();
|
||||
@ -575,6 +605,8 @@ class PlayState extends MusicBeatState
|
||||
camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
boyfriend = new Boyfriend(770, 450, SONG.player1);
|
||||
|
||||
// REPOSITIONING PER STAGE
|
||||
@ -677,11 +709,25 @@ class PlayState extends MusicBeatState
|
||||
// healthBar
|
||||
add(healthBar);
|
||||
|
||||
scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width - 190, healthBarBG.y + 30, 0, "", 20);
|
||||
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT);
|
||||
// Add Kade Engine watermark
|
||||
var kadeEngineWatermark = new FlxText(4,FlxG.height - 4,0,SONG.song + " " + (storyDifficulty == 2 ? "Hard" : storyDifficulty == 1 ? "Normal" : "Easy") + " - KE " + MainMenuState.kadeEngineVer, 16);
|
||||
kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
|
||||
kadeEngineWatermark.scrollFactor.set();
|
||||
add(kadeEngineWatermark);
|
||||
|
||||
scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 150, healthBarBG.y + 50, 0, "", 20);
|
||||
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
|
||||
scoreTxt.scrollFactor.set();
|
||||
add(scoreTxt);
|
||||
|
||||
replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (FlxG.save.data.downscroll ? 100 : -100), 0, "REPLAY", 20);
|
||||
replayTxt.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
|
||||
replayTxt.scrollFactor.set();
|
||||
if (loadRep)
|
||||
{
|
||||
add(replayTxt);
|
||||
}
|
||||
|
||||
iconP1 = new HealthIcon(SONG.player1, true);
|
||||
iconP1.y = healthBar.y - (iconP1.height / 2);
|
||||
add(iconP1);
|
||||
@ -758,6 +804,9 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadRep)
|
||||
rep = new Replay("na");
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
@ -1236,6 +1285,13 @@ class PlayState extends MusicBeatState
|
||||
var startedCountdown:Bool = false;
|
||||
var canPause:Bool = true;
|
||||
|
||||
function truncateFloat( number : Float, precision : Int): Float {
|
||||
var num = number;
|
||||
num = num * Math.pow(10, precision);
|
||||
num = Math.round( num ) / Math.pow(10, precision);
|
||||
return num;
|
||||
}
|
||||
|
||||
override public function update(elapsed:Float)
|
||||
{
|
||||
#if !debug
|
||||
@ -1268,7 +1324,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
super.update(elapsed);
|
||||
|
||||
scoreTxt.text = "Score:" + songScore;
|
||||
scoreTxt.text = "Score:" + songScore + " | Misses:" + misses + " | Accuracy:" + truncateFloat(accuracy, 2) + "% " + (fc ? "| FC" : misses == 0 ? "| A" : accuracy <= 75 ? "| BAD" : "");
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
|
||||
{
|
||||
@ -1513,20 +1569,6 @@ class PlayState extends MusicBeatState
|
||||
daNote.active = true;
|
||||
}
|
||||
|
||||
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)));
|
||||
|
||||
// i am so fucking sorry for this if condition
|
||||
if (daNote.isSustainNote
|
||||
&& daNote.y + daNote.offset.y <= strumLine.y + Note.swagWidth / 2
|
||||
&& (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))))
|
||||
{
|
||||
var swagRect = new FlxRect(0, strumLine.y + Note.swagWidth / 2 - daNote.y, daNote.width * 2, daNote.height * 2);
|
||||
swagRect.y /= daNote.scale.y;
|
||||
swagRect.height -= swagRect.y;
|
||||
|
||||
daNote.clipRect = swagRect;
|
||||
}
|
||||
|
||||
if (!daNote.mustPress && daNote.wasGoodHit)
|
||||
{
|
||||
if (SONG.song != 'Tutorial')
|
||||
@ -1542,14 +1584,14 @@ class PlayState extends MusicBeatState
|
||||
|
||||
switch (Math.abs(daNote.noteData))
|
||||
{
|
||||
case 0:
|
||||
dad.playAnim('singLEFT' + altAnim, true);
|
||||
case 1:
|
||||
dad.playAnim('singDOWN' + altAnim, true);
|
||||
case 2:
|
||||
dad.playAnim('singUP' + altAnim, true);
|
||||
case 3:
|
||||
dad.playAnim('singRIGHT' + altAnim, true);
|
||||
case 1:
|
||||
dad.playAnim('singDOWN' + altAnim, true);
|
||||
case 0:
|
||||
dad.playAnim('singLEFT' + altAnim, true);
|
||||
}
|
||||
|
||||
dad.holdTimer = 0;
|
||||
@ -1562,15 +1604,28 @@ class PlayState extends MusicBeatState
|
||||
daNote.destroy();
|
||||
}
|
||||
|
||||
if (FlxG.save.data.downscroll)
|
||||
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (-0.45 * FlxMath.roundDecimal(SONG.speed, 2)));
|
||||
else
|
||||
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)));
|
||||
//trace(daNote.y);
|
||||
// WIP interpolation shit? Need to fix the pause issue
|
||||
// daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed));
|
||||
|
||||
if (daNote.y < -daNote.height)
|
||||
if (daNote.y < -daNote.height && !FlxG.save.data.downscroll || daNote.y >= strumLine.y + 106 && FlxG.save.data.downscroll)
|
||||
{
|
||||
if (daNote.tooLate || !daNote.wasGoodHit)
|
||||
if (daNote.isSustainNote && daNote.wasGoodHit)
|
||||
{
|
||||
health -= 0.0475;
|
||||
daNote.kill();
|
||||
notes.remove(daNote, true);
|
||||
daNote.destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
health -= 0.075;
|
||||
vocals.volume = 0;
|
||||
if (theFunne)
|
||||
noteMiss(daNote.noteData);
|
||||
}
|
||||
|
||||
daNote.active = false;
|
||||
@ -1583,6 +1638,7 @@ class PlayState extends MusicBeatState
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (!inCutscene)
|
||||
keyShit();
|
||||
|
||||
@ -1594,6 +1650,9 @@ class PlayState extends MusicBeatState
|
||||
|
||||
function endSong():Void
|
||||
{
|
||||
if (!loadRep)
|
||||
rep.SaveReplay();
|
||||
|
||||
canPause = false;
|
||||
FlxG.sound.music.volume = 0;
|
||||
vocals.volume = 0;
|
||||
@ -1692,21 +1751,50 @@ class PlayState extends MusicBeatState
|
||||
|
||||
var daRating:String = "sick";
|
||||
|
||||
if (noteDiff > Conductor.safeZoneOffset * 0.9)
|
||||
if (noteDiff > Conductor.safeZoneOffset * 2)
|
||||
{
|
||||
daRating = 'shit';
|
||||
score = 50;
|
||||
totalNotesHit -= 2;
|
||||
noteMiss(0);
|
||||
score = -3000;
|
||||
ss = false;
|
||||
shits++;
|
||||
}
|
||||
else if (noteDiff > Conductor.safeZoneOffset * 0.75)
|
||||
else if (noteDiff < Conductor.safeZoneOffset * -2)
|
||||
{
|
||||
daRating = 'shit';
|
||||
totalNotesHit -= 2;
|
||||
noteMiss(0);
|
||||
score = -3000;
|
||||
ss = false;
|
||||
shits++;
|
||||
}
|
||||
else if (noteDiff > Conductor.safeZoneOffset * 0.45)
|
||||
{
|
||||
daRating = 'bad';
|
||||
score = 100;
|
||||
score = -1000;
|
||||
totalNotesHit += 0.2;
|
||||
ss = false;
|
||||
bads++;
|
||||
}
|
||||
else if (noteDiff > Conductor.safeZoneOffset * 0.2)
|
||||
else if (noteDiff > Conductor.safeZoneOffset * 0.25)
|
||||
{
|
||||
daRating = 'good';
|
||||
totalNotesHit += 0.65;
|
||||
score = 200;
|
||||
ss = false;
|
||||
goods++;
|
||||
}
|
||||
if (daRating == 'sick')
|
||||
{
|
||||
totalNotesHit += 1;
|
||||
sicks++;
|
||||
}
|
||||
|
||||
|
||||
if (daRating != 'shit' || daRating != 'bad')
|
||||
{
|
||||
|
||||
|
||||
songScore += score;
|
||||
|
||||
@ -1827,6 +1915,17 @@ class PlayState extends MusicBeatState
|
||||
|
||||
curSection += 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function NearlyEquals(value1:Float, value2:Float, unimportantDifference:Float = 10):Bool
|
||||
{
|
||||
return Math.abs(FlxMath.roundDecimal(value1, 1) - FlxMath.roundDecimal(value2, 1)) < unimportantDifference;
|
||||
}
|
||||
|
||||
var upHold:Bool = false;
|
||||
var downHold:Bool = false;
|
||||
var rightHold:Bool = false;
|
||||
var leftHold:Bool = false;
|
||||
|
||||
private function keyShit():Void
|
||||
{
|
||||
@ -1846,11 +1945,68 @@ class PlayState extends MusicBeatState
|
||||
var downR = controls.DOWN_R;
|
||||
var leftR = controls.LEFT_R;
|
||||
|
||||
if (loadRep) // replay code
|
||||
{
|
||||
// disable input
|
||||
up = false;
|
||||
down = false;
|
||||
right = false;
|
||||
left = false;
|
||||
|
||||
// new input
|
||||
|
||||
|
||||
//if (rep.replay.keys[repPresses].time == Conductor.songPosition)
|
||||
// trace('DO IT!!!!!');
|
||||
|
||||
//timeCurrently = Math.abs(rep.replay.keyPresses[repPresses].time - Conductor.songPosition);
|
||||
//timeCurrentlyR = Math.abs(rep.replay.keyReleases[repReleases].time - Conductor.songPosition);
|
||||
|
||||
|
||||
if (repPresses < rep.replay.keyPresses.length && repReleases < rep.replay.keyReleases.length)
|
||||
{
|
||||
upP = NearlyEquals(rep.replay.keyPresses[repPresses].time, Conductor.songPosition) && rep.replay.keyPresses[repPresses].key == "up";
|
||||
rightP = NearlyEquals(rep.replay.keyPresses[repPresses].time, Conductor.songPosition) && rep.replay.keyPresses[repPresses].key == "right";
|
||||
downP = NearlyEquals(rep.replay.keyPresses[repPresses].time, Conductor.songPosition) && rep.replay.keyPresses[repPresses].key == "down";
|
||||
leftP = NearlyEquals(rep.replay.keyPresses[repPresses].time, Conductor.songPosition) && rep.replay.keyPresses[repPresses].key == "left";
|
||||
|
||||
upR = NearlyEquals(rep.replay.keyReleases[repReleases].time, Conductor.songPosition) && rep.replay.keyReleases[repReleases].key == "up";
|
||||
rightR = NearlyEquals(rep.replay.keyReleases[repReleases].time, Conductor.songPosition) && rep.replay.keyReleases[repReleases].key == "right";
|
||||
downR = NearlyEquals(rep.replay.keyReleases[repReleases].time, Conductor.songPosition) && rep.replay.keyReleases[repReleases].key == "down";
|
||||
leftR = NearlyEquals(rep.replay.keyReleases[repReleases].time, Conductor.songPosition) && rep.replay.keyReleases[repReleases].key == "left";
|
||||
|
||||
upHold = upP ? true : upR ? false : true;
|
||||
rightHold = rightP ? true : rightR ? false : true;
|
||||
downHold = downP ? true : downR ? false : true;
|
||||
leftHold = leftP ? true : leftR ? false : true;
|
||||
}
|
||||
}
|
||||
else if (!loadRep) // record replay code
|
||||
{
|
||||
if (upP)
|
||||
rep.replay.keyPresses.push({time: Conductor.songPosition, key: "up"});
|
||||
if (rightP)
|
||||
rep.replay.keyPresses.push({time: Conductor.songPosition, key: "right"});
|
||||
if (downP)
|
||||
rep.replay.keyPresses.push({time: Conductor.songPosition, key: "down"});
|
||||
if (leftP)
|
||||
rep.replay.keyPresses.push({time: Conductor.songPosition, key: "left"});
|
||||
|
||||
if (upR)
|
||||
rep.replay.keyReleases.push({time: Conductor.songPosition, key: "up"});
|
||||
if (rightR)
|
||||
rep.replay.keyReleases.push({time: Conductor.songPosition, key: "right"});
|
||||
if (downR)
|
||||
rep.replay.keyReleases.push({time: Conductor.songPosition, key: "down"});
|
||||
if (leftR)
|
||||
rep.replay.keyReleases.push({time: Conductor.songPosition, key: "left"});
|
||||
}
|
||||
var controlArray:Array<Bool> = [leftP, downP, upP, rightP];
|
||||
|
||||
// FlxG.watch.addQuick('asdfa', upP);
|
||||
if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic)
|
||||
{
|
||||
repPresses++;
|
||||
boyfriend.holdTimer = 0;
|
||||
|
||||
var possibleNotes:Array<Note> = [];
|
||||
@ -1859,7 +2015,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
{
|
||||
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
|
||||
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate)
|
||||
{
|
||||
// the sorting probably doesn't need to be in here? who cares lol
|
||||
possibleNotes.push(daNote);
|
||||
@ -1869,6 +2025,7 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (possibleNotes.length > 0)
|
||||
{
|
||||
var daNote = possibleNotes[0];
|
||||
@ -1893,25 +2050,58 @@ class PlayState extends MusicBeatState
|
||||
if (controlArray[ignoreList[shit]])
|
||||
inIgnoreList = true;
|
||||
}
|
||||
if (!inIgnoreList)
|
||||
if (!inIgnoreList && !theFunne)
|
||||
badNoteCheck();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (possibleNotes[0].noteData == possibleNotes[1].noteData)
|
||||
{
|
||||
if (loadRep)
|
||||
{
|
||||
if (NearlyEquals(daNote.strumTime,rep.replay.keyPresses[repPresses].time, 30))
|
||||
{
|
||||
goodNoteHit(daNote);
|
||||
trace('force note hit');
|
||||
}
|
||||
else
|
||||
noteCheck(controlArray[daNote.noteData], daNote);
|
||||
}
|
||||
else
|
||||
noteCheck(controlArray[daNote.noteData], daNote);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (coolNote in possibleNotes)
|
||||
{
|
||||
if (loadRep)
|
||||
{
|
||||
if (NearlyEquals(coolNote.strumTime,rep.replay.keyPresses[repPresses].time, 30))
|
||||
{
|
||||
goodNoteHit(coolNote);
|
||||
trace('force note hit');
|
||||
}
|
||||
else
|
||||
noteCheck(controlArray[daNote.noteData], daNote);
|
||||
}
|
||||
else
|
||||
noteCheck(controlArray[coolNote.noteData], coolNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // regular notes?
|
||||
{
|
||||
if (loadRep)
|
||||
{
|
||||
if (NearlyEquals(daNote.strumTime,rep.replay.keyPresses[repPresses].time, 30))
|
||||
{
|
||||
goodNoteHit(daNote);
|
||||
trace('force note hit');
|
||||
}
|
||||
else
|
||||
noteCheck(controlArray[daNote.noteData], daNote);
|
||||
}
|
||||
else
|
||||
noteCheck(controlArray[daNote.noteData], daNote);
|
||||
}
|
||||
/*
|
||||
@ -1935,23 +2125,21 @@ class PlayState extends MusicBeatState
|
||||
if (upP || rightP || downP || leftP)
|
||||
noteCheck(leftP, daNote);
|
||||
}
|
||||
|
||||
//this is already done in noteCheck / goodNoteHit
|
||||
*/
|
||||
if (daNote.wasGoodHit)
|
||||
{
|
||||
daNote.kill();
|
||||
notes.remove(daNote, true);
|
||||
daNote.destroy();
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
else if (!theFunne)
|
||||
{
|
||||
badNoteCheck();
|
||||
}
|
||||
}
|
||||
|
||||
if ((up || right || down || left) && !boyfriend.stunned && generatedMusic)
|
||||
if ((up || right || down || left) && generatedMusic || (upHold || downHold || leftHold || rightHold) && loadRep && generatedMusic)
|
||||
{
|
||||
notes.forEachAlive(function(daNote:Note)
|
||||
{
|
||||
@ -1960,17 +2148,17 @@ class PlayState extends MusicBeatState
|
||||
switch (daNote.noteData)
|
||||
{
|
||||
// NOTES YOU ARE HOLDING
|
||||
case 0:
|
||||
if (left)
|
||||
goodNoteHit(daNote);
|
||||
case 1:
|
||||
if (down)
|
||||
goodNoteHit(daNote);
|
||||
case 2:
|
||||
if (up)
|
||||
if (up || upHold)
|
||||
goodNoteHit(daNote);
|
||||
case 3:
|
||||
if (right)
|
||||
if (right || rightHold)
|
||||
goodNoteHit(daNote);
|
||||
case 1:
|
||||
if (down || downHold)
|
||||
goodNoteHit(daNote);
|
||||
case 0:
|
||||
if (left || leftHold)
|
||||
goodNoteHit(daNote);
|
||||
}
|
||||
}
|
||||
@ -1989,26 +2177,41 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
switch (spr.ID)
|
||||
{
|
||||
case 0:
|
||||
if (leftP && spr.animation.curAnim.name != 'confirm')
|
||||
spr.animation.play('pressed');
|
||||
if (leftR)
|
||||
spr.animation.play('static');
|
||||
case 1:
|
||||
if (downP && spr.animation.curAnim.name != 'confirm')
|
||||
spr.animation.play('pressed');
|
||||
if (downR)
|
||||
spr.animation.play('static');
|
||||
case 2:
|
||||
if (upP && spr.animation.curAnim.name != 'confirm')
|
||||
{
|
||||
spr.animation.play('pressed');
|
||||
trace('play');
|
||||
}
|
||||
if (upR)
|
||||
{
|
||||
spr.animation.play('static');
|
||||
repReleases++;
|
||||
}
|
||||
case 3:
|
||||
if (rightP && spr.animation.curAnim.name != 'confirm')
|
||||
spr.animation.play('pressed');
|
||||
if (rightR)
|
||||
{
|
||||
spr.animation.play('static');
|
||||
repReleases++;
|
||||
}
|
||||
case 1:
|
||||
if (downP && spr.animation.curAnim.name != 'confirm')
|
||||
spr.animation.play('pressed');
|
||||
if (downR)
|
||||
{
|
||||
spr.animation.play('static');
|
||||
repReleases++;
|
||||
}
|
||||
case 0:
|
||||
if (leftP && spr.animation.curAnim.name != 'confirm')
|
||||
spr.animation.play('pressed');
|
||||
if (leftR)
|
||||
{
|
||||
spr.animation.play('static');
|
||||
repReleases++;
|
||||
}
|
||||
}
|
||||
|
||||
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
|
||||
@ -2039,14 +2242,6 @@ class PlayState extends MusicBeatState
|
||||
// FlxG.sound.play(Paths.sound('missnote1'), 1, false);
|
||||
// FlxG.log.add('played imss note');
|
||||
|
||||
boyfriend.stunned = true;
|
||||
|
||||
// get stunned for 5 seconds
|
||||
new FlxTimer().start(5 / 60, function(tmr:FlxTimer)
|
||||
{
|
||||
boyfriend.stunned = false;
|
||||
});
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 0:
|
||||
@ -2072,19 +2267,49 @@ class PlayState extends MusicBeatState
|
||||
|
||||
if (leftP)
|
||||
noteMiss(0);
|
||||
if (downP)
|
||||
noteMiss(1);
|
||||
if (upP)
|
||||
noteMiss(2);
|
||||
if (rightP)
|
||||
noteMiss(3);
|
||||
if (downP)
|
||||
noteMiss(1);
|
||||
updateAccuracy();
|
||||
}
|
||||
|
||||
function noteCheck(keyP:Bool, note:Note):Void
|
||||
function updateAccuracy()
|
||||
{
|
||||
if (misses > 0 || accuracy < 96)
|
||||
fc = false;
|
||||
else
|
||||
fc = true;
|
||||
totalPlayed += 1;
|
||||
accuracy = totalNotesHit / totalPlayed * 100;
|
||||
}
|
||||
|
||||
|
||||
function noteCheck(keyP:Bool, note:Note):Void // sorry lol
|
||||
{
|
||||
if (loadRep)
|
||||
{
|
||||
if (keyP)
|
||||
goodNoteHit(note);
|
||||
else
|
||||
else if (!theFunne)
|
||||
badNoteCheck();
|
||||
else if (rep.replay.keyPresses.length > repPresses && !keyP)
|
||||
{
|
||||
if (NearlyEquals(note.strumTime,rep.replay.keyPresses[repPresses].time, 4))
|
||||
{
|
||||
goodNoteHit(note);
|
||||
}
|
||||
else if (!theFunne)
|
||||
badNoteCheck();
|
||||
}
|
||||
}
|
||||
else if (keyP)
|
||||
{
|
||||
goodNoteHit(note);
|
||||
}
|
||||
else if (!theFunne)
|
||||
{
|
||||
badNoteCheck();
|
||||
}
|
||||
@ -2099,6 +2324,8 @@ class PlayState extends MusicBeatState
|
||||
popUpScore(note.strumTime);
|
||||
combo += 1;
|
||||
}
|
||||
else
|
||||
totalNotesHit += 1;
|
||||
|
||||
if (note.noteData >= 0)
|
||||
health += 0.023;
|
||||
@ -2107,14 +2334,14 @@ class PlayState extends MusicBeatState
|
||||
|
||||
switch (note.noteData)
|
||||
{
|
||||
case 0:
|
||||
boyfriend.playAnim('singLEFT', true);
|
||||
case 1:
|
||||
boyfriend.playAnim('singDOWN', true);
|
||||
case 2:
|
||||
boyfriend.playAnim('singUP', true);
|
||||
case 3:
|
||||
boyfriend.playAnim('singRIGHT', true);
|
||||
case 1:
|
||||
boyfriend.playAnim('singDOWN', true);
|
||||
case 0:
|
||||
boyfriend.playAnim('singLEFT', true);
|
||||
}
|
||||
|
||||
playerStrums.forEach(function(spr:FlxSprite)
|
||||
@ -2128,14 +2355,14 @@ class PlayState extends MusicBeatState
|
||||
note.wasGoodHit = true;
|
||||
vocals.volume = 1;
|
||||
|
||||
if (!note.isSustainNote)
|
||||
{
|
||||
note.kill();
|
||||
notes.remove(note, true);
|
||||
note.destroy();
|
||||
|
||||
updateAccuracy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var fastCarCanDrive:Bool = true;
|
||||
|
||||
|
101
source/Replay.hx
Normal file
101
source/Replay.hx
Normal file
@ -0,0 +1,101 @@
|
||||
#if sys
|
||||
import sys.io.File;
|
||||
#end
|
||||
import Controls.Control;
|
||||
import flixel.FlxG;
|
||||
import openfl.events.IOErrorEvent;
|
||||
import openfl.events.Event;
|
||||
import openfl.net.FileReference;
|
||||
import lime.utils.Assets;
|
||||
import haxe.Json;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
import openfl.utils.Dictionary;
|
||||
|
||||
typedef KeyPress =
|
||||
{
|
||||
public var time:Float;
|
||||
public var key:String;
|
||||
}
|
||||
|
||||
typedef KeyRelease =
|
||||
{
|
||||
public var time:Float;
|
||||
public var key:String;
|
||||
}
|
||||
|
||||
typedef ReplayJSON =
|
||||
{
|
||||
public var replayGameVer:String;
|
||||
public var timestamp:Date;
|
||||
public var songName:String;
|
||||
public var songDiff:Int;
|
||||
public var keyPresses:Array<KeyPress>;
|
||||
public var keyReleases:Array<KeyRelease>;
|
||||
}
|
||||
|
||||
class Replay
|
||||
{
|
||||
public static var version:String = "1.0"; // replay file version
|
||||
|
||||
public var path:String = "";
|
||||
public var replay:ReplayJSON;
|
||||
public function new(path:String)
|
||||
{
|
||||
this.path = path;
|
||||
replay = {
|
||||
songName: "Tutorial",
|
||||
songDiff: 1,
|
||||
keyPresses: [],
|
||||
keyReleases: [],
|
||||
replayGameVer: version,
|
||||
timestamp: Date.now()
|
||||
};
|
||||
}
|
||||
|
||||
public static function LoadReplay(path:String):Replay
|
||||
{
|
||||
var rep:Replay = new Replay(path);
|
||||
|
||||
rep.LoadFromJSON();
|
||||
|
||||
trace('basic replay data:\nSong Name: ' + rep.replay.songName + '\nSong Diff: ' + rep.replay.songDiff + '\nKeys Length: ' + rep.replay.keyPresses.length);
|
||||
|
||||
return rep;
|
||||
}
|
||||
|
||||
public function SaveReplay()
|
||||
{
|
||||
var json = {
|
||||
"songName": PlayState.SONG.song.toLowerCase(),
|
||||
"songDiff": PlayState.storyDifficulty,
|
||||
"keyPresses": replay.keyPresses,
|
||||
"keyReleases": replay.keyReleases,
|
||||
"timestamp": Date.now(),
|
||||
"replayGameVer": version
|
||||
};
|
||||
|
||||
var data:String = Json.stringify(json);
|
||||
|
||||
#if sys
|
||||
File.saveContent("assets/replays/replay-" + PlayState.SONG.song + "-time" + Date.now().getTime() + ".kadeReplay", data);
|
||||
#end
|
||||
}
|
||||
|
||||
|
||||
public function LoadFromJSON()
|
||||
{
|
||||
#if sys
|
||||
trace('loading ' + Sys.getCwd() + 'assets\\replays\\' + path + ' replay...');
|
||||
try
|
||||
{
|
||||
var repl:ReplayJSON = cast Json.parse(File.getContent(Sys.getCwd() + "assets\\replays\\" + path));
|
||||
replay = repl;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
trace('failed!\n' + e.message);
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
}
|
@ -54,7 +54,7 @@ class TitleState extends MusicBeatState
|
||||
|
||||
super.create();
|
||||
|
||||
NGio.noLogin(APIStuff.API);
|
||||
// NGio.noLogin(APIStuff.API);
|
||||
|
||||
#if ng
|
||||
var ng:NGio = new NGio(APIStuff.API, APIStuff.EncKey);
|
||||
@ -364,10 +364,9 @@ class TitleState extends MusicBeatState
|
||||
// credTextShit.text = 'In association \nwith';
|
||||
// credTextShit.screenCenter();
|
||||
case 5:
|
||||
createCoolText(['In association', 'with']);
|
||||
createCoolText(['Kade Engine', 'by']);
|
||||
case 7:
|
||||
addMoreText('newgrounds');
|
||||
ngSpr.visible = true;
|
||||
addMoreText('KadeDeveloper');
|
||||
// credTextShit.text += '\nNewgrounds';
|
||||
case 8:
|
||||
deleteCoolText();
|
||||
|
Loading…
x
Reference in New Issue
Block a user