diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index bdb1770dc..6749c2a59 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -23,6 +23,7 @@ import funkin.charting.ChartingState; import funkin.modding.IHook; import funkin.modding.events.ScriptEvent; import funkin.modding.events.ScriptEventDispatcher; +import funkin.play.GameOverSubstate; import funkin.play.HealthIcon; import funkin.play.Strumline.StrumlineArrow; import funkin.play.Strumline.StrumlineStyle; @@ -31,15 +32,12 @@ import funkin.play.character.CharacterData; import funkin.play.scoring.Scoring; import funkin.play.stage.Stage; import funkin.play.stage.StageData; -import funkin.play.GameOverSubstate; import funkin.ui.PopUpStuff; import funkin.ui.PreferencesMenu; import funkin.ui.stageBuildShit.StageOffsetSubstate; import funkin.util.Constants; import funkin.util.SortUtil; import lime.ui.Haptic; -import openfl.Assets; -import openfl.filters.ShaderFilter; using StringTools; @@ -1344,8 +1342,6 @@ class PlayState extends MusicBeatState implements IHook if (!isInCutscene) keyShit(true); - - dispatchEvent(new UpdateScriptEvent(elapsed)); } function applyClipRect(daNote:Note):Void diff --git a/source/funkin/play/stage/Stage.hx b/source/funkin/play/stage/Stage.hx index 421315d64..de693e9c5 100644 --- a/source/funkin/play/stage/Stage.hx +++ b/source/funkin/play/stage/Stage.hx @@ -62,28 +62,41 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte { buildStage(); this.refresh(); + + debugIconGroup = new FlxSpriteGroup(); + debugIconGroup.visible = false; + debugIconGroup.zIndex = 1000000; + add(debugIconGroup); } - public function resetStage():Void { + public function resetStage():Void + { // Reset positions of characters. - if (getBoyfriend() != null) { + if (getBoyfriend() != null) + { getBoyfriend().resetCharacter(false); - } else { + } + else + { trace('STAGE RESET: No boyfriend found.'); } - if (getGirlfriend() != null) { + if (getGirlfriend() != null) + { getGirlfriend().resetCharacter(false); } - if (getDad() != null) { + if (getDad() != null) + { getDad().resetCharacter(false); } // Reset positions of named props. - for (dataProp in _data.props) { + for (dataProp in _data.props) + { // Fetch the prop. var prop:FlxSprite = getNamedProp(dataProp.name); - if (prop != null) { + if (prop != null) + { // Reset the position. prop.x = dataProp.position[0]; prop.y = dataProp.position[1]; @@ -104,6 +117,8 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte this.camZoom = _data.cameraZoom; + this.debugIconGroup = new FlxSpriteGroup(); + for (dataProp in _data.props) { trace(' Placing prop: ${dataProp.name} (${dataProp.assetPath})'); @@ -270,6 +285,8 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte clipRectTransform(sprite, clipRect); } + var debugIconGroup:FlxSpriteGroup; + /** * Used by the PlayState to add a character to the stage. */ @@ -348,8 +365,8 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte // Add the character to the scene. this.add(character); - this.add(debugIcon); - this.add(debugIcon2); + debugIconGroup.add(debugIcon); + debugIconGroup.add(debugIcon2); } public inline function getGirlfriendPosition():FlxPoint @@ -512,6 +529,14 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte } } group.clear(); + if (debugIconGroup != null && debugIconGroup.group != null) + { + debugIconGroup.kill(); + } + else + { + debugIconGroup = null; + } } /** @@ -535,6 +560,14 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte } } + public function onUpdate(event:UpdateScriptEvent) + { + if (FlxG.keys.justPressed.F3) + { + debugIconGroup.visible = !debugIconGroup.visible; + } + } + public function onScriptEvent(event:ScriptEvent) {} public function onPause(event:PauseScriptEvent) {} @@ -553,8 +586,6 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte public function onCountdownEnd(event:CountdownScriptEvent) {} - public function onUpdate(event:UpdateScriptEvent) {} - public function onNoteHit(event:NoteScriptEvent) {} public function onNoteMiss(event:NoteScriptEvent) {}