Merge branch 'master' of https://github.com/KadeDev/Kade-Engine
This commit is contained in:
commit
61bb9625cf
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.FlxG;
|
||||
@ -285,32 +286,31 @@ class Alphabet extends FlxSpriteGroup
|
||||
// ThatGuy: Ooga booga function for resizing text, with the option of wanting it to have the same midPoint
|
||||
// Side note: Do not, EVER, do updateHitbox() unless you are retyping the whole thing. Don't know why, but the position gets retarded if you do that
|
||||
public function resizeText(xScale:Float, yScale:Float, xStaysCentered:Bool = true, yStaysCentered:Bool = false):Void {
|
||||
var oldWidth:Float = this.width;
|
||||
var oldHeight:Float = this.height;
|
||||
//trace('old x before scaling: ' + this.x);
|
||||
//trace('old midpoint before scaling: ' + this.getMidpoint().x);
|
||||
var oldMidpoint:FlxPoint = this.getMidpoint();
|
||||
reType(text, xScale, yScale);
|
||||
//trace('old x after scaling: ' + this.x);
|
||||
//trace('old midpoint after scaling: ' + this.getMidpoint().x);
|
||||
//This works, commenting out all the tracing
|
||||
if(!(xStaysCentered && yStaysCentered)){
|
||||
if(xStaysCentered) {
|
||||
/*
|
||||
If oldX is the old position, that is the same for both sizes of text, e.g. oldX = 50
|
||||
And oldWidth is the old width of the text, e.g. oldWidth = 100
|
||||
And newWidth is the current width of the text, e.g. newWidth= 150
|
||||
And the midpoint, is always the same, e.g. midpoint = oldX + oldWidth/2 = 50 + 100/2 = 100
|
||||
and the newMidpoint, which is equal to midpoint, is newX + newWidth/2, then
|
||||
newX = midpoint - newWidth/2 <=> newX = oldX + oldWidth/2 - newWidth/2, e.g., <=> newX = 50 + 100/2 - 150/2 <=> newX = 25
|
||||
*/
|
||||
//Since this.x doesnt change with text scaling, in this equation, this.x can be used as both the old and the new x
|
||||
this.x = this.x + oldWidth/2 - this.width/2;
|
||||
//trace('new x after scaling: ' + this.x);
|
||||
//trace('new midpoint after scaling: ' + this.getMidpoint().x);
|
||||
//I can just use this juicy new function i made
|
||||
moveTextToMidpoint(new FlxPoint(oldMidpoint.x, getMidpoint().y));
|
||||
}
|
||||
if(yStaysCentered) {
|
||||
// Same logic applies here
|
||||
this.y = this.y + oldHeight/2 - this.height/2;
|
||||
moveTextToMidpoint(new FlxPoint(getMidpoint().x, oldMidpoint.y));
|
||||
}
|
||||
} else {
|
||||
moveTextToMidpoint(new FlxPoint(oldMidpoint.x, oldMidpoint.y));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ThatGuy: Function used to keep text centered on one point instead of manually having to come up with offsets for each sentence
|
||||
public function moveTextToMidpoint(midpoint:FlxPoint):Void {
|
||||
/*
|
||||
e.g. You want your midpoint at (100, 100)
|
||||
and your text is 200 wide, 50 tall
|
||||
then, x = 100 - 200/2, y = 100 - 50/2
|
||||
*/
|
||||
this.x = midpoint.x - this.width / 2;
|
||||
this.y = midpoint.y - this.height / 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,16 @@ class GameOverState extends FlxTransitionableState
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if(FlxG.save.data.InstantRespawn)
|
||||
{
|
||||
fading = true;
|
||||
FlxG.sound.music.fadeOut(0.5, 0, function(twn:FlxTween)
|
||||
{
|
||||
FlxG.sound.music.stop();
|
||||
LoadingState.loadAndSwitchState(new PlayState());
|
||||
});
|
||||
}
|
||||
|
||||
if (gamepad != null)
|
||||
{
|
||||
if (gamepad.justPressed.ANY)
|
||||
|
@ -59,6 +59,11 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
endBullshit();
|
||||
}
|
||||
|
||||
if(FlxG.save.data.InstantRespawn)
|
||||
{
|
||||
LoadingState.loadAndSwitchState(new PlayState());
|
||||
}
|
||||
|
||||
if (controls.BACK)
|
||||
{
|
||||
FlxG.sound.music.stop();
|
||||
|
@ -82,6 +82,9 @@ class KadeEngineData
|
||||
if (FlxG.save.data.resetButton == null)
|
||||
FlxG.save.data.resetButton = false;
|
||||
|
||||
if (FlxG.save.data.InstantRespawn == null)
|
||||
FlxG.save.data.InstantRespawn = false;
|
||||
|
||||
if (FlxG.save.data.botplay == null)
|
||||
FlxG.save.data.botplay = false;
|
||||
|
||||
|
@ -307,6 +307,27 @@ class ResetButtonOption extends Option
|
||||
}
|
||||
}
|
||||
|
||||
class InstantRespawn extends Option
|
||||
{
|
||||
public function new(desc:String)
|
||||
{
|
||||
super();
|
||||
description = desc;
|
||||
}
|
||||
|
||||
public override function press():Bool
|
||||
{
|
||||
FlxG.save.data.InstantRespawn = !FlxG.save.data.InstantRespawn;
|
||||
display = updateDisplay();
|
||||
return true;
|
||||
}
|
||||
|
||||
private override function updateDisplay():String
|
||||
{
|
||||
return "Instant Respawn " + (!FlxG.save.data.InstantRespawn ? "off" : "on");
|
||||
}
|
||||
}
|
||||
|
||||
class FlashingLightsOption extends Option
|
||||
{
|
||||
public function new(desc:String)
|
||||
|
@ -36,6 +36,7 @@ class OptionsMenu extends MusicBeatState
|
||||
new ScrollSpeedOption("Change your scroll speed. (1 = Chart dependent)"),
|
||||
new AccuracyDOption("Change how accuracy is calculated. (Accurate = Simple, Complex = Milisecond Based)"),
|
||||
new ResetButtonOption("Toggle pressing R to gameover."),
|
||||
new InstantRespawn("Toggle if you instantly respawn after dying."),
|
||||
// new OffsetMenu("Get a note offset based off of your inputs!"),
|
||||
new CustomizeGameplay("Drag and drop gameplay modules to your prefered positions!")
|
||||
]),
|
||||
|
@ -456,32 +456,11 @@ class PlayState extends MusicBeatState
|
||||
trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: '
|
||||
+ Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay);
|
||||
|
||||
// dialogue shit
|
||||
switch (songLowercase)
|
||||
switch(songLowercase)
|
||||
{
|
||||
case 'tutorial':
|
||||
dialogue = ["Hey you're pretty cute.", 'Use the arrow keys to keep up \nwith me singing.'];
|
||||
case 'bopeebo':
|
||||
dialogue = [
|
||||
'HEY!',
|
||||
"You think you can just sing\nwith my daughter like that?",
|
||||
"If you want to date her...",
|
||||
"You're going to have to go \nthrough ME first!"
|
||||
];
|
||||
case 'fresh':
|
||||
dialogue = ["Not too shabby boy.", ""];
|
||||
case 'dadbattle':
|
||||
dialogue = [
|
||||
"gah you think you're hot stuff?",
|
||||
"If you can beat me here...",
|
||||
"Only then I will even CONSIDER letting you\ndate my daughter!"
|
||||
];
|
||||
case 'senpai':
|
||||
dialogue = CoolUtil.coolTextFile(Paths.txt('data/senpai/senpaiDialogue'));
|
||||
case 'roses':
|
||||
dialogue = CoolUtil.coolTextFile(Paths.txt('data/roses/rosesDialogue'));
|
||||
case 'thorns':
|
||||
dialogue = CoolUtil.coolTextFile(Paths.txt('data/thorns/thornsDialogue'));
|
||||
//if the song has dialogue, so we don't accidentally try to load a nonexistant file and crash the game
|
||||
case 'senpai' | 'roses' | 'thorns':
|
||||
dialogue = CoolUtil.coolTextFile(Paths.txt('data/' + songLowercase + '/dialogue'));
|
||||
}
|
||||
|
||||
// defaults if no stage was found in chart
|
||||
|
Loading…
x
Reference in New Issue
Block a user