un-sabotage's your hit windows

This commit is contained in:
Kade M 2021-06-04 14:15:26 -07:00
parent b28b793374
commit a79b29ce14
3 changed files with 63 additions and 9 deletions

View File

@ -674,14 +674,14 @@ class ChartingState extends MusicBeatState
writingNotes = !writingNotes;
}
/*if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT)
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT)
snap = snap * 2;
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.LEFT)
snap = Math.round(snap / 2);
if (snap >= 192)
snap = 192;
if (snap <= 1)
snap = 1;*/
snap = 1;
Conductor.songPosition = FlxG.sound.music.time;
_song.song = typingShit.text;
@ -944,7 +944,16 @@ class ChartingState extends MusicBeatState
FlxG.sound.music.pause();
vocals.pause();
FlxG.sound.music.time = curStep * Conductor.stepCrochet - (FlxG.mouse.wheel * Conductor.stepCrochet / snap);
var stepMs = curStep * Conductor.stepCrochet;
if (FlxG.sound.music.time < 0)
FlxG.sound.music.time = 0;
trace(Conductor.stepCrochet / snap);
FlxG.sound.music.time = (stepMs + (Conductor.stepCrochet / snap)) * FlxG.mouse.wheel;
trace(stepMs + " + " + Conductor.stepCrochet / snap + " -> " + FlxG.sound.music.time);
vocals.time = FlxG.sound.music.time;
}

View File

@ -1,6 +1,8 @@
// this file is for modchart things, this is to declutter playstate.hx
// Lua
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
#if windows
import flixel.tweens.FlxEase;
import openfl.filters.ShaderFilter;
@ -250,6 +252,33 @@ class ModchartState
PlayState.instance.iconP2.animation.play(id);
}
function makeAnimatedLuaSprite(spritePath:String,names:Array<String>,prefixes:Array<String>,startAnim:String, id:String)
{
#if sys
var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + PlayState.SONG.song.toLowerCase() + '/' + spritePath + ".png");
var sprite:FlxSprite = new FlxSprite(0,0);
sprite.frames = FlxAtlasFrames.fromSparrow(FlxGraphic.fromBitmapData(data), Sys.getCwd() + "assets/data/" + PlayState.SONG.song.toLowerCase() + "/" + spritePath + ".xml");
trace(sprite.frames.frames.length);
for (p in 0...names.length)
{
var i = names[p];
var ii = prefixes[p];
sprite.animation.addByPrefix(i,ii,24,false);
}
luaSprites.set(id,sprite);
PlayState.instance.addObject(sprite);
sprite.animation.play(startAnim);
return id;
#end
}
function makeLuaSprite(spritePath:String,toBeCalled:String, drawBehind:Bool)
{
#if sys
@ -374,6 +403,8 @@ class ModchartState
Lua_helper.add_callback(lua,"getProperty", getPropertyByName);
Lua_helper.add_callback(lua,"makeAnimatedSprite", makeAnimatedLuaSprite);
Lua_helper.add_callback(lua,"destroySprite", function(id:String) {
var sprite = luaSprites.get(id);
if (sprite == null)
@ -382,6 +413,8 @@ class ModchartState
return true;
});
// hud/camera
Lua_helper.add_callback(lua,"setHudAngle", function (x:Float) {
@ -752,7 +785,8 @@ class ModchartState
Lua_helper.add_callback(lua,"tweenFadeOut", function(id:String, toAlpha:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {alpha: toAlpha}, time, {ease: FlxEase.circOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
//forgot and accidentally commit to master branch
//forgot and accidentally commit to master branch
// shader
/*Lua_helper.add_callback(lua,"createShader", function(frag:String,vert:String) {

View File

@ -190,12 +190,23 @@ class Note extends FlxSprite
if (mustPress)
{
// The * 0.5 is so that it's easier to hit them too late, instead of too early
if (strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * 1.5)
&& strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5))
canBeHit = true;
// ass
if (isSustainNote)
{
if (strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * 1.5)
&& strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5))
canBeHit = true;
else
canBeHit = false;
}
else
canBeHit = false;
{
if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset
&& strumTime < Conductor.songPosition + Conductor.safeZoneOffset)
canBeHit = true;
else
canBeHit = false;
}
if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset * Conductor.timeScale && !wasGoodHit)
tooLate = true;