mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-04-21 19:31:52 -04:00
some combo popup / playstate lil cleanup
This commit is contained in:
parent
5c09417329
commit
d6db576585
7 changed files with 228 additions and 159 deletions
source
|
@ -10,6 +10,7 @@ import flixel.math.FlxPoint;
|
|||
import flixel.math.FlxRect;
|
||||
import flixel.util.FlxColor;
|
||||
import openfl.display.BitmapData;
|
||||
import play.PicoFight;
|
||||
import ui.PreferencesMenu;
|
||||
import ui.stageBuildShit.StageBuilderState;
|
||||
|
||||
|
@ -160,6 +161,8 @@ class InitState extends FlxTransitionableState
|
|||
FlxG.switchState(new ChartingState());
|
||||
#elseif STAGEBUILD
|
||||
FlxG.switchState(new StageBuilderState());
|
||||
#elseif FIGHT
|
||||
FlxG.switchState(new PicoFight());
|
||||
#elseif ANIMDEBUG
|
||||
FlxG.switchState(new ui.animDebugShit.DebugBoundingState());
|
||||
#elseif NETTEST
|
||||
|
|
|
@ -30,6 +30,7 @@ import lime.utils.Assets;
|
|||
import shaderslmfao.BuildingShaders;
|
||||
import shaderslmfao.ColorSwap;
|
||||
import shaderslmfao.OverlayBlend;
|
||||
import ui.PopUpStuff;
|
||||
import ui.PreferencesMenu;
|
||||
|
||||
using StringTools;
|
||||
|
@ -73,6 +74,10 @@ class PlayState extends MusicBeatState
|
|||
private static var prevCamFollow:FlxObject;
|
||||
|
||||
private var strumLineNotes:FlxTypedGroup<FlxSprite>;
|
||||
|
||||
/**
|
||||
* Strumline for player
|
||||
*/
|
||||
private var playerStrums:FlxTypedGroup<FlxSprite>;
|
||||
|
||||
private var camZooming:Bool = false;
|
||||
|
@ -154,6 +159,8 @@ class PlayState extends MusicBeatState
|
|||
var camPos:FlxPoint;
|
||||
var lightFadeShader:BuildingShaders;
|
||||
|
||||
var comboPopUps:PopUpStuff;
|
||||
|
||||
override public function create()
|
||||
{
|
||||
initCameras();
|
||||
|
@ -210,6 +217,9 @@ class PlayState extends MusicBeatState
|
|||
|
||||
// fake notesplash cache type deal so that it loads in the graphic?
|
||||
|
||||
comboPopUps = new PopUpStuff();
|
||||
add(comboPopUps);
|
||||
|
||||
grpNoteSplashes = new FlxTypedGroup<NoteSplash>();
|
||||
|
||||
var noteSplash:NoteSplash = new NoteSplash(100, 100, 0);
|
||||
|
@ -2278,10 +2288,10 @@ class PlayState extends MusicBeatState
|
|||
{
|
||||
if (combo > 5 && gf.animOffsets.exists('sad'))
|
||||
gf.playAnim('sad');
|
||||
|
||||
if (combo != 0)
|
||||
{
|
||||
combo = 0;
|
||||
displayCombo();
|
||||
combo = comboPopUps.displayCombo(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2411,13 +2421,9 @@ class PlayState extends MusicBeatState
|
|||
// boyfriend.playAnim('hey');
|
||||
vocals.volume = 1;
|
||||
|
||||
var rating:FlxSprite = new FlxSprite();
|
||||
var score:Int = 350;
|
||||
|
||||
var daRating:String = "sick";
|
||||
|
||||
var isSick:Bool = true;
|
||||
|
||||
var healthMulti:Float = 1;
|
||||
|
||||
if (daNote.lowStakes)
|
||||
|
@ -2463,150 +2469,10 @@ class PlayState extends MusicBeatState
|
|||
if (!practiceMode)
|
||||
songScore += score;
|
||||
|
||||
// ludum dare rating system
|
||||
/* if (combo > 60)
|
||||
daRating = 'sick';
|
||||
else if (combo > 12)
|
||||
daRating = 'good'
|
||||
else if (combo > 4)
|
||||
daRating = 'bad';
|
||||
*/
|
||||
comboPopUps.displayRating(daRating);
|
||||
|
||||
var ratingPath:String = daRating;
|
||||
|
||||
if (curStage.startsWith('school'))
|
||||
ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel";
|
||||
|
||||
rating.loadGraphic(Paths.image(ratingPath));
|
||||
rating.x = FlxG.width * 0.55 - 40;
|
||||
// make sure rating is visible lol!
|
||||
if (rating.x < FlxG.camera.scroll.x)
|
||||
rating.x = FlxG.camera.scroll.x;
|
||||
else if (rating.x > FlxG.camera.scroll.x + FlxG.camera.width - rating.width)
|
||||
rating.x = FlxG.camera.scroll.x + FlxG.camera.width - rating.width;
|
||||
|
||||
rating.y = FlxG.camera.scroll.y + FlxG.camera.height * 0.4 - 60;
|
||||
rating.acceleration.y = 550;
|
||||
rating.velocity.y -= FlxG.random.int(140, 175);
|
||||
rating.velocity.x -= FlxG.random.int(0, 10);
|
||||
|
||||
add(rating);
|
||||
|
||||
if (curStage.startsWith('school'))
|
||||
{
|
||||
rating.setGraphicSize(Std.int(rating.width * daPixelZoom * 0.7));
|
||||
}
|
||||
else
|
||||
{
|
||||
rating.setGraphicSize(Std.int(rating.width * 0.7));
|
||||
rating.antialiasing = true;
|
||||
}
|
||||
rating.updateHitbox();
|
||||
|
||||
FlxTween.tween(rating, {alpha: 0}, 0.2, {
|
||||
onComplete: function(tween:FlxTween)
|
||||
{
|
||||
rating.destroy();
|
||||
},
|
||||
startDelay: Conductor.crochet * 0.001
|
||||
});
|
||||
if (combo >= 10 || combo == 0)
|
||||
displayCombo();
|
||||
}
|
||||
|
||||
function displayCombo():Void
|
||||
{
|
||||
var pixelShitPart1:String = "";
|
||||
var pixelShitPart2:String = '';
|
||||
|
||||
if (curStage.startsWith('school'))
|
||||
{
|
||||
pixelShitPart1 = 'weeb/pixelUI/';
|
||||
pixelShitPart2 = '-pixel';
|
||||
}
|
||||
|
||||
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2));
|
||||
comboSpr.y = FlxG.camera.scroll.y + FlxG.camera.height * 0.4 + 80;
|
||||
comboSpr.x = FlxG.width * 0.55;
|
||||
// make sure combo is visible lol!
|
||||
// 194 fits 4 combo digits
|
||||
if (comboSpr.x < FlxG.camera.scroll.x + 194)
|
||||
comboSpr.x = FlxG.camera.scroll.x + 194;
|
||||
else if (comboSpr.x > FlxG.camera.scroll.x + FlxG.camera.width - comboSpr.width)
|
||||
comboSpr.x = FlxG.camera.scroll.x + FlxG.camera.width - comboSpr.width;
|
||||
|
||||
comboSpr.acceleration.y = 600;
|
||||
comboSpr.velocity.y -= 150;
|
||||
comboSpr.velocity.x += FlxG.random.int(1, 10);
|
||||
|
||||
add(comboSpr);
|
||||
|
||||
if (curStage.startsWith('school'))
|
||||
{
|
||||
comboSpr.setGraphicSize(Std.int(comboSpr.width * daPixelZoom * 0.7));
|
||||
}
|
||||
else
|
||||
{
|
||||
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
|
||||
comboSpr.antialiasing = true;
|
||||
}
|
||||
comboSpr.updateHitbox();
|
||||
|
||||
FlxTween.tween(comboSpr, {alpha: 0}, 0.2, {
|
||||
onComplete: function(tween:FlxTween)
|
||||
{
|
||||
comboSpr.destroy();
|
||||
},
|
||||
startDelay: Conductor.crochet * 0.001
|
||||
});
|
||||
|
||||
var seperatedScore:Array<Int> = [];
|
||||
var tempCombo:Int = combo;
|
||||
|
||||
while (tempCombo != 0)
|
||||
{
|
||||
seperatedScore.push(tempCombo % 10);
|
||||
tempCombo = Std.int(tempCombo / 10);
|
||||
}
|
||||
while (seperatedScore.length < 3)
|
||||
seperatedScore.push(0);
|
||||
|
||||
// seperatedScore.reverse();
|
||||
|
||||
var daLoop:Int = 1;
|
||||
for (i in seperatedScore)
|
||||
{
|
||||
var numScore:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2));
|
||||
numScore.y = comboSpr.y;
|
||||
|
||||
if (curStage.startsWith('school'))
|
||||
{
|
||||
numScore.setGraphicSize(Std.int(numScore.width * daPixelZoom));
|
||||
}
|
||||
else
|
||||
{
|
||||
numScore.antialiasing = true;
|
||||
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
|
||||
}
|
||||
numScore.updateHitbox();
|
||||
|
||||
numScore.x = comboSpr.x - (43 * daLoop); //- 90;
|
||||
numScore.acceleration.y = FlxG.random.int(200, 300);
|
||||
numScore.velocity.y -= FlxG.random.int(140, 160);
|
||||
numScore.velocity.x = FlxG.random.float(-5, 5);
|
||||
|
||||
add(numScore);
|
||||
|
||||
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
|
||||
onComplete: function(tween:FlxTween)
|
||||
{
|
||||
numScore.destroy();
|
||||
},
|
||||
startDelay: Conductor.crochet * 0.002
|
||||
});
|
||||
|
||||
daLoop++;
|
||||
}
|
||||
comboPopUps.displayCombo(combo);
|
||||
}
|
||||
|
||||
var cameraRightSide:Bool = false;
|
||||
|
@ -2895,7 +2761,7 @@ class PlayState extends MusicBeatState
|
|||
combo += 1;
|
||||
popUpScore(note.data.strumTime, note);
|
||||
}
|
||||
|
||||
|
||||
boyfriend.playAnim('sing' + note.dirNameUpper, true);
|
||||
|
||||
playerStrums.forEach(function(spr:FlxSprite)
|
||||
|
@ -3094,7 +2960,7 @@ class PlayState extends MusicBeatState
|
|||
if (curBeat % 8 == 7
|
||||
&& song[step].mustHitSection
|
||||
&& combo > 5
|
||||
&& song.length > step + 1// GK: this fixes an error on week 1 where song[step + 1] was null
|
||||
&& song.length > step + 1 // GK: this fixes an error on week 1 where song[step + 1] was null
|
||||
&& !song[step + 1].mustHitSection)
|
||||
{
|
||||
var animShit:ComboCounter = new ComboCounter(-100, 300, combo);
|
||||
|
|
|
@ -172,18 +172,12 @@ class SongLoad
|
|||
if (noteStuff == null)
|
||||
return;
|
||||
|
||||
trace(noteStuff);
|
||||
|
||||
for (sectionIndex => section in noteStuff)
|
||||
{
|
||||
for (noteIndex => noteDataArray in section.sectionNotes)
|
||||
{
|
||||
trace(noteDataArray);
|
||||
|
||||
var arrayDipshit:Array<Dynamic> = cast noteDataArray; // crackhead
|
||||
|
||||
trace(arrayDipshit);
|
||||
|
||||
if (arrayDipshit != null) // array isnt null, that means it loaded it as an array and needs to be manually parsed?
|
||||
{
|
||||
// at this point noteStuff[sectionIndex].sectionNotes[noteIndex] is an array because of the cast from the first line in this function
|
||||
|
@ -258,7 +252,6 @@ class SongLoad
|
|||
{
|
||||
swagShit.difficulties.push(diff);
|
||||
swagShit.noteMap[diff] = cast Reflect.field(songParsed.song.notes, diff);
|
||||
trace(swagShit.noteMap[diff]);
|
||||
|
||||
castArrayToNoteData(swagShit.noteMap[diff]);
|
||||
|
||||
|
|
|
@ -63,6 +63,8 @@ class PolygonSpectogram extends MeshRender
|
|||
{
|
||||
clear();
|
||||
|
||||
start = Math.max(start, 0);
|
||||
|
||||
var samplesToGen:Int = Std.int(sampleRate * seconds);
|
||||
// gets which sample to start at
|
||||
var startSample:Int = Std.int(FlxMath.remapToRange(start, 0, vis.snd.length, 0, numSamples));
|
||||
|
|
|
@ -951,8 +951,14 @@ class ChartingState extends MusicBeatState
|
|||
{
|
||||
// FlxG.sound.music.time += daTime;
|
||||
|
||||
FlxG.sound.music.play();
|
||||
vocals.play();
|
||||
FlxG.sound.music.pause();
|
||||
vocals.pause();
|
||||
|
||||
FlxG.sound.music.time += daTime;
|
||||
vocals.time = FlxG.sound.music.time;
|
||||
|
||||
// FlxG.sound.music.play();
|
||||
// vocals.play();
|
||||
|
||||
#if HAS_PITCH
|
||||
FlxG.sound.music.pitch = 0.2;
|
||||
|
|
36
source/play/PicoFight.hx
Normal file
36
source/play/PicoFight.hx
Normal file
|
@ -0,0 +1,36 @@
|
|||
package play;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
|
||||
class PicoFight extends MusicBeatState
|
||||
{
|
||||
var picoHealth:Float = 1;
|
||||
var darnellHealth:Float = 1;
|
||||
|
||||
override function create()
|
||||
{
|
||||
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height);
|
||||
bg.scrollFactor.set();
|
||||
add(bg);
|
||||
|
||||
// fuk u, hardcoded bullshit bitch
|
||||
FlxG.sound.playMusic(Paths.inst("blazin"));
|
||||
Conductor.bpm = 180;
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
Conductor.songPosition = FlxG.sound.music.time;
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
override function beatHit()
|
||||
{
|
||||
picoHealth += 1;
|
||||
trace(picoHealth);
|
||||
super.beatHit();
|
||||
}
|
||||
}
|
163
source/ui/PopUpStuff.hx
Normal file
163
source/ui/PopUpStuff.hx
Normal file
|
@ -0,0 +1,163 @@
|
|||
package ui;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.tweens.FlxTween;
|
||||
|
||||
using StringTools;
|
||||
|
||||
class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||
{
|
||||
override public function new()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function displayRating(daRating:String)
|
||||
{
|
||||
if (daRating == null)
|
||||
daRating = "good";
|
||||
|
||||
var rating:FlxSprite = new FlxSprite();
|
||||
var ratingPath:String = daRating;
|
||||
|
||||
if (PlayState.curStage.startsWith('school'))
|
||||
ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel";
|
||||
|
||||
rating.loadGraphic(Paths.image(ratingPath));
|
||||
rating.x = FlxG.width * 0.55 - 40;
|
||||
// make sure rating is visible lol!
|
||||
if (rating.x < FlxG.camera.scroll.x)
|
||||
rating.x = FlxG.camera.scroll.x;
|
||||
else if (rating.x > FlxG.camera.scroll.x + FlxG.camera.width - rating.width)
|
||||
rating.x = FlxG.camera.scroll.x + FlxG.camera.width - rating.width;
|
||||
|
||||
rating.y = FlxG.camera.scroll.y + FlxG.camera.height * 0.4 - 60;
|
||||
rating.acceleration.y = 550;
|
||||
rating.velocity.y -= FlxG.random.int(140, 175);
|
||||
rating.velocity.x -= FlxG.random.int(0, 10);
|
||||
|
||||
add(rating);
|
||||
|
||||
if (PlayState.curStage.startsWith('school'))
|
||||
{
|
||||
rating.setGraphicSize(Std.int(rating.width * PlayState.daPixelZoom * 0.7));
|
||||
}
|
||||
else
|
||||
{
|
||||
rating.setGraphicSize(Std.int(rating.width * 0.7));
|
||||
rating.antialiasing = true;
|
||||
}
|
||||
rating.updateHitbox();
|
||||
|
||||
FlxTween.tween(rating, {alpha: 0}, 0.2, {
|
||||
onComplete: function(tween:FlxTween)
|
||||
{
|
||||
remove(rating, true);
|
||||
rating.destroy();
|
||||
},
|
||||
startDelay: Conductor.crochet * 0.001
|
||||
});
|
||||
}
|
||||
|
||||
public function displayCombo(?combo:Int = 0):Int
|
||||
{
|
||||
if (combo == null)
|
||||
combo = 0;
|
||||
|
||||
var pixelShitPart1:String = "";
|
||||
var pixelShitPart2:String = '';
|
||||
|
||||
if (PlayState.curStage.startsWith('school'))
|
||||
{
|
||||
pixelShitPart1 = 'weeb/pixelUI/';
|
||||
pixelShitPart2 = '-pixel';
|
||||
}
|
||||
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2));
|
||||
comboSpr.y = FlxG.camera.scroll.y + FlxG.camera.height * 0.4 + 80;
|
||||
comboSpr.x = FlxG.width * 0.55;
|
||||
// make sure combo is visible lol!
|
||||
// 194 fits 4 combo digits
|
||||
if (comboSpr.x < FlxG.camera.scroll.x + 194)
|
||||
comboSpr.x = FlxG.camera.scroll.x + 194;
|
||||
else if (comboSpr.x > FlxG.camera.scroll.x + FlxG.camera.width - comboSpr.width)
|
||||
comboSpr.x = FlxG.camera.scroll.x + FlxG.camera.width - comboSpr.width;
|
||||
|
||||
comboSpr.acceleration.y = 600;
|
||||
comboSpr.velocity.y -= 150;
|
||||
comboSpr.velocity.x += FlxG.random.int(1, 10);
|
||||
|
||||
add(comboSpr);
|
||||
|
||||
if (PlayState.curStage.startsWith('school'))
|
||||
{
|
||||
comboSpr.setGraphicSize(Std.int(comboSpr.width * PlayState.daPixelZoom * 0.7));
|
||||
}
|
||||
else
|
||||
{
|
||||
comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7));
|
||||
comboSpr.antialiasing = true;
|
||||
}
|
||||
comboSpr.updateHitbox();
|
||||
|
||||
FlxTween.tween(comboSpr, {alpha: 0}, 0.2, {
|
||||
onComplete: function(tween:FlxTween)
|
||||
{
|
||||
remove(comboSpr, true);
|
||||
comboSpr.destroy();
|
||||
},
|
||||
startDelay: Conductor.crochet * 0.001
|
||||
});
|
||||
|
||||
var seperatedScore:Array<Int> = [];
|
||||
var tempCombo:Int = combo;
|
||||
|
||||
while (tempCombo != 0)
|
||||
{
|
||||
seperatedScore.push(tempCombo % 10);
|
||||
tempCombo = Std.int(tempCombo / 10);
|
||||
}
|
||||
while (seperatedScore.length < 3)
|
||||
seperatedScore.push(0);
|
||||
|
||||
// seperatedScore.reverse();
|
||||
|
||||
var daLoop:Int = 1;
|
||||
for (i in seperatedScore)
|
||||
{
|
||||
var numScore:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2));
|
||||
numScore.y = comboSpr.y;
|
||||
|
||||
if (PlayState.curStage.startsWith('school'))
|
||||
{
|
||||
numScore.setGraphicSize(Std.int(numScore.width * PlayState.daPixelZoom));
|
||||
}
|
||||
else
|
||||
{
|
||||
numScore.antialiasing = true;
|
||||
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
|
||||
}
|
||||
numScore.updateHitbox();
|
||||
|
||||
numScore.x = comboSpr.x - (43 * daLoop); //- 90;
|
||||
numScore.acceleration.y = FlxG.random.int(200, 300);
|
||||
numScore.velocity.y -= FlxG.random.int(140, 160);
|
||||
numScore.velocity.x = FlxG.random.float(-5, 5);
|
||||
|
||||
add(numScore);
|
||||
|
||||
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
|
||||
onComplete: function(tween:FlxTween)
|
||||
{
|
||||
remove(numScore, true);
|
||||
numScore.destroy();
|
||||
},
|
||||
startDelay: Conductor.crochet * 0.002
|
||||
});
|
||||
|
||||
daLoop++;
|
||||
}
|
||||
|
||||
return combo;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue