Merge branch 'master' of https://github.com/KadeDev/Kade-Engine
This commit is contained in:
@@ -47,11 +47,20 @@ class Alphabet extends FlxSpriteGroup
|
||||
var pastX:Float = 0;
|
||||
var pastY:Float = 0;
|
||||
|
||||
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false, shouldMove:Bool = false)
|
||||
// ThatGuy: Variables here to be used later
|
||||
var xScale:Float;
|
||||
var yScale:Float;
|
||||
|
||||
// ThatGuy: Added 2 more variables, xScale and yScale for resizing text
|
||||
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false, shouldMove:Bool = false, xScale:Float = 1, yScale:Float = 1)
|
||||
{
|
||||
pastX = x;
|
||||
pastY = y;
|
||||
|
||||
// ThatGuy: Have to assign these variables
|
||||
this.xScale = xScale;
|
||||
this.yScale = yScale;
|
||||
|
||||
super(x, y);
|
||||
|
||||
_finalText = text;
|
||||
@@ -72,7 +81,7 @@ class Alphabet extends FlxSpriteGroup
|
||||
}
|
||||
}
|
||||
|
||||
public function reType(text)
|
||||
public function reType(text, xScale:Float = 1, yScale:Float = 1)
|
||||
{
|
||||
for (i in listOAlphabets)
|
||||
remove(i);
|
||||
@@ -86,6 +95,9 @@ class Alphabet extends FlxSpriteGroup
|
||||
listOAlphabets.clear();
|
||||
x = pastX;
|
||||
y = pastY;
|
||||
|
||||
this.xScale = xScale;
|
||||
this.yScale = yScale;
|
||||
|
||||
addText();
|
||||
}
|
||||
@@ -111,17 +123,24 @@ class Alphabet extends FlxSpriteGroup
|
||||
{
|
||||
if (lastSprite != null)
|
||||
{
|
||||
xPos = lastSprite.x + lastSprite.width;
|
||||
// ThatGuy: This is the line that fixes the spacing error when the x position of this class's objects was anything other than 0
|
||||
xPos = lastSprite.x - pastX + lastSprite.width;
|
||||
}
|
||||
|
||||
if (lastWasSpace)
|
||||
{
|
||||
xPos += 40;
|
||||
// ThatGuy: Also this line
|
||||
xPos += 40 * xScale;
|
||||
lastWasSpace = false;
|
||||
}
|
||||
|
||||
// var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
|
||||
var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
|
||||
|
||||
// ThatGuy: These are the lines that change the individual scaling of each character
|
||||
letter.scale.set(xScale, yScale);
|
||||
letter.updateHitbox();
|
||||
|
||||
listOAlphabets.add(letter);
|
||||
|
||||
if (isBold)
|
||||
@@ -147,6 +166,7 @@ class Alphabet extends FlxSpriteGroup
|
||||
|
||||
public var personTalking:String = 'gf';
|
||||
|
||||
// ThatGuy: THIS FUNCTION ISNT CHANGED! Because i dont use it lol
|
||||
public function startTypedText():Void
|
||||
{
|
||||
_finalText = text;
|
||||
@@ -261,6 +281,37 @@ class Alphabet extends FlxSpriteGroup
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
// 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);
|
||||
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) {
|
||||
/*
|
||||
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);
|
||||
}
|
||||
if(yStaysCentered) {
|
||||
// Same logic applies here
|
||||
this.y = this.y + oldHeight/2 - this.height/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AlphaCharacter extends FlxSprite
|
||||
@@ -278,7 +329,10 @@ class AlphaCharacter extends FlxSprite
|
||||
super(x, y);
|
||||
var tex = Paths.getSparrowAtlas('alphabet');
|
||||
frames = tex;
|
||||
antialiasing = FlxG.save.data.antialiasing;
|
||||
if(FlxG.save.data.antialiasing)
|
||||
{
|
||||
antialiasing = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function createBold(letter:String)
|
||||
|
||||
@@ -170,6 +170,6 @@ class Paths
|
||||
#end
|
||||
else
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker(image('characters/$key'), file('images/characters/$key.txt', library));
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/characters/$key.txt', library));
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
var notesHitArray:Array<Date> = [];
|
||||
var currentFrames:Int = 0;
|
||||
var idleToBeat:Bool = true; // change if bf and dad would idle to the beat of the song
|
||||
var idleToBeat:Bool = false; // change if bf and dad would idle to the beat of the song
|
||||
var idleBeat:Int = 4; // how frequently bf and dad would play their idle animation(1 - every beat, 2 - every 2 beats and so on)
|
||||
|
||||
public var dialogue:Array<String> = ['dad:blah blah blah', 'bf:coolswag'];
|
||||
@@ -3259,6 +3259,17 @@ class PlayState extends MusicBeatState
|
||||
spr.centerOffsets();
|
||||
}
|
||||
});
|
||||
if (PlayStateChangeables.botPlay)
|
||||
{
|
||||
playerStrums.forEach(function(spr:FlxSprite)
|
||||
{
|
||||
if (spr.animation.finished)
|
||||
{
|
||||
spr.animation.play('static');
|
||||
spr.centerOffsets();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!inCutscene && songStarted)
|
||||
@@ -3928,6 +3939,24 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
goodNoteHit(daNote);
|
||||
boyfriend.holdTimer = daNote.sustainLength;
|
||||
if (FlxG.save.data.cpuStrums)
|
||||
{
|
||||
playerStrums.forEach(function(spr:FlxSprite)
|
||||
{
|
||||
if (Math.abs(daNote.noteData) == spr.ID)
|
||||
{
|
||||
spr.animation.play('confirm', true);
|
||||
}
|
||||
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
|
||||
{
|
||||
spr.centerOffsets();
|
||||
spr.offset.x -= 13;
|
||||
spr.offset.y -= 13;
|
||||
}
|
||||
else
|
||||
spr.centerOffsets();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3939,22 +3968,25 @@ class PlayState extends MusicBeatState
|
||||
boyfriend.playAnim('idle');
|
||||
}
|
||||
|
||||
playerStrums.forEach(function(spr:FlxSprite)
|
||||
if (!PlayStateChangeables.botPlay)
|
||||
{
|
||||
if (keys[spr.ID] && spr.animation.curAnim.name != 'confirm')
|
||||
spr.animation.play('pressed', false);
|
||||
if (!keys[spr.ID])
|
||||
spr.animation.play('static', false);
|
||||
|
||||
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
|
||||
playerStrums.forEach(function(spr:FlxSprite)
|
||||
{
|
||||
spr.centerOffsets();
|
||||
spr.offset.x -= 13;
|
||||
spr.offset.y -= 13;
|
||||
}
|
||||
else
|
||||
spr.centerOffsets();
|
||||
});
|
||||
if (keys[spr.ID] && spr.animation.curAnim.name != 'confirm')
|
||||
spr.animation.play('pressed', false);
|
||||
if (!keys[spr.ID])
|
||||
spr.animation.play('static', false);
|
||||
|
||||
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
|
||||
{
|
||||
spr.centerOffsets();
|
||||
spr.offset.x -= 13;
|
||||
spr.offset.y -= 13;
|
||||
}
|
||||
else
|
||||
spr.centerOffsets();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function findByTime(time:Float):Array<Dynamic>
|
||||
|
||||
@@ -88,7 +88,7 @@ class ResultsScreen extends FlxSubState
|
||||
var bads = PlayState.isStoryMode ? PlayState.campaignBads : PlayState.bads;
|
||||
var shits = PlayState.isStoryMode ? PlayState.campaignShits : PlayState.shits;
|
||||
|
||||
comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${sicks}\nBads - ${bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\n${!PlayState.loadRep ? "F1 - View replay\nF2 - Replay song" : ""}
|
||||
comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${sicks}\nGoods - ${goods}\nBads - ${bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\n${!PlayState.loadRep ? "F1 - View replay\nF2 - Replay song" : ""}
|
||||
');
|
||||
comboText.size = 28;
|
||||
comboText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
|
||||
|
||||
Reference in New Issue
Block a user