mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-02-02 17:58:08 +00:00
fixed bullshit
This commit is contained in:
parent
4eab1c34ed
commit
6f7b3e67ef
74
source/LatencyState.hx
Normal file
74
source/LatencyState.hx
Normal file
|
@ -0,0 +1,74 @@
|
|||
package;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.text.FlxText;
|
||||
|
||||
class LatencyState extends FlxState
|
||||
{
|
||||
var offsetText:FlxText;
|
||||
var noteGrp:FlxTypedGroup<Note>;
|
||||
var strumLine:FlxSprite;
|
||||
|
||||
override function create()
|
||||
{
|
||||
FlxG.sound.playMusic('assets/sounds/soundTest' + TitleState.soundExt);
|
||||
|
||||
noteGrp = new FlxTypedGroup<Note>();
|
||||
add(noteGrp);
|
||||
|
||||
for (i in 0...32)
|
||||
{
|
||||
var note:Note = new Note(Conductor.crochet * i, 1);
|
||||
noteGrp.add(note);
|
||||
}
|
||||
|
||||
offsetText = new FlxText();
|
||||
offsetText.screenCenter();
|
||||
add(offsetText);
|
||||
|
||||
strumLine = new FlxSprite(FlxG.width / 2, 100).makeGraphic(FlxG.width, 5);
|
||||
add(strumLine);
|
||||
|
||||
Conductor.changeBPM(120);
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
offsetText.text = "Offset: " + Conductor.offset + "ms";
|
||||
|
||||
Conductor.songPosition = FlxG.sound.music.time - Conductor.offset;
|
||||
|
||||
var multiply:Float = 1;
|
||||
|
||||
if (FlxG.keys.pressed.SHIFT)
|
||||
multiply = 10;
|
||||
|
||||
if (FlxG.keys.justPressed.RIGHT)
|
||||
Conductor.offset += 1 * multiply;
|
||||
if (FlxG.keys.justPressed.LEFT)
|
||||
Conductor.offset -= 1 * multiply;
|
||||
|
||||
if (FlxG.keys.justPressed.SPACE)
|
||||
{
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
FlxG.resetState();
|
||||
}
|
||||
|
||||
noteGrp.forEach(function(daNote:Note)
|
||||
{
|
||||
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * 0.45);
|
||||
daNote.x = strumLine.x + 30;
|
||||
|
||||
if (daNote.y < strumLine.y)
|
||||
daNote.kill();
|
||||
});
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
}
|
|
@ -19,10 +19,13 @@ class Note extends FlxSprite
|
|||
|
||||
public static var swagWidth:Float = 160 * 0.7;
|
||||
|
||||
public function new(strumTime:Float, noteData:Int, prevNote:Note)
|
||||
public function new(strumTime:Float, noteData:Int, ?prevNote:Note)
|
||||
{
|
||||
super();
|
||||
|
||||
if (prevNote == null)
|
||||
prevNote = this;
|
||||
|
||||
this.prevNote = prevNote;
|
||||
|
||||
x += 50;
|
||||
|
|
|
@ -18,9 +18,14 @@ import flixel.util.FlxTimer;
|
|||
class TitleState extends FlxTransitionableState
|
||||
{
|
||||
static var initialized:Bool = false;
|
||||
static public var soundExt:String = ".mp3";
|
||||
|
||||
override public function create():Void
|
||||
{
|
||||
#if (!web)
|
||||
TitleState.soundExt = '.ogg';
|
||||
#end
|
||||
|
||||
super.create();
|
||||
|
||||
if (!initialized)
|
||||
|
@ -64,7 +69,7 @@ class TitleState extends FlxTransitionableState
|
|||
FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG});
|
||||
FlxTween.tween(logo, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.1});
|
||||
|
||||
FlxG.sound.playMusic('assets/music/title.mp3', 0, false);
|
||||
FlxG.sound.playMusic('assets/music/title' + TitleState.soundExt, 0, false);
|
||||
|
||||
FlxG.sound.music.fadeIn(4, 0, 0.7);
|
||||
}
|
||||
|
@ -84,7 +89,7 @@ class TitleState extends FlxTransitionableState
|
|||
{
|
||||
FlxG.switchState(new PlayState());
|
||||
});
|
||||
FlxG.sound.play('assets/music/titleShoot.mp3', 0.7);
|
||||
FlxG.sound.play('assets/music/titleShoot' + TitleState.soundExt, 0.7);
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
|
|
Loading…
Reference in a new issue