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; writingNotes = !writingNotes;
} }
/*if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT) if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT)
snap = snap * 2; snap = snap * 2;
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.LEFT) if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.LEFT)
snap = Math.round(snap / 2); snap = Math.round(snap / 2);
if (snap >= 192) if (snap >= 192)
snap = 192; snap = 192;
if (snap <= 1) if (snap <= 1)
snap = 1;*/ snap = 1;
Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time;
_song.song = typingShit.text; _song.song = typingShit.text;
@ -944,7 +944,16 @@ class ChartingState extends MusicBeatState
FlxG.sound.music.pause(); FlxG.sound.music.pause();
vocals.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; vocals.time = FlxG.sound.music.time;
} }

View File

@ -1,6 +1,8 @@
// this file is for modchart things, this is to declutter playstate.hx // this file is for modchart things, this is to declutter playstate.hx
// Lua // Lua
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
#if windows #if windows
import flixel.tweens.FlxEase; import flixel.tweens.FlxEase;
import openfl.filters.ShaderFilter; import openfl.filters.ShaderFilter;
@ -249,6 +251,33 @@ class ModchartState
PlayState.instance.addObject(PlayState.boyfriend); PlayState.instance.addObject(PlayState.boyfriend);
PlayState.instance.iconP2.animation.play(id); 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) function makeLuaSprite(spritePath:String,toBeCalled:String, drawBehind:Bool)
{ {
@ -373,6 +402,8 @@ class ModchartState
Lua_helper.add_callback(lua,"changeBoyfriendCharacter", changeBoyfriendCharacter); Lua_helper.add_callback(lua,"changeBoyfriendCharacter", changeBoyfriendCharacter);
Lua_helper.add_callback(lua,"getProperty", getPropertyByName); Lua_helper.add_callback(lua,"getProperty", getPropertyByName);
Lua_helper.add_callback(lua,"makeAnimatedSprite", makeAnimatedLuaSprite);
Lua_helper.add_callback(lua,"destroySprite", function(id:String) { Lua_helper.add_callback(lua,"destroySprite", function(id:String) {
var sprite = luaSprites.get(id); var sprite = luaSprites.get(id);
@ -381,6 +412,8 @@ class ModchartState
PlayState.instance.removeObject(sprite); PlayState.instance.removeObject(sprite);
return true; return true;
}); });
// hud/camera // hud/camera
@ -752,7 +785,8 @@ class ModchartState
Lua_helper.add_callback(lua,"tweenFadeOut", function(id:String, toAlpha:Float, time:Float, onComplete:String) { 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]);}}}); 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 // shader
/*Lua_helper.add_callback(lua,"createShader", function(frag:String,vert:String) { /*Lua_helper.add_callback(lua,"createShader", function(frag:String,vert:String) {

View File

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