1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-15 17:17:17 +00:00

can move the characters around, and some pos fixes

This commit is contained in:
Cameron Taylor 2022-05-01 14:52:58 -04:00
parent a5857313c5
commit 8231f432ff

View file

@ -3,6 +3,7 @@ package funkin.ui.stageBuildShit;
import flixel.math.FlxPoint; import flixel.math.FlxPoint;
import flixel.ui.FlxButton; import flixel.ui.FlxButton;
import funkin.play.PlayState; import funkin.play.PlayState;
import funkin.play.character.BaseCharacter;
import funkin.play.stage.StageData; import funkin.play.stage.StageData;
import haxe.Json; import haxe.Json;
import openfl.Assets; import openfl.Assets;
@ -29,6 +30,10 @@ class StageOffsetSubstate extends MusicBeatSubstate
stageLol.characters.dad.position[0] = Std.int(dadPos.x); stageLol.characters.dad.position[0] = Std.int(dadPos.x);
stageLol.characters.dad.position[1] = Std.int(dadPos.y); stageLol.characters.dad.position[1] = Std.int(dadPos.y);
var GF_FEET_SNIIIIIIIIIIIIIFFFF = PlayState.instance.currentStage.getGirlfriend().feetPosition;
stageLol.characters.gf.position[0] = Std.int(GF_FEET_SNIIIIIIIIIIIIIFFFF.x);
stageLol.characters.gf.position[1] = Std.int(GF_FEET_SNIIIIIIIIIIIIIFFFF.y);
var outputJson = CoolUtil.jsonStringify(stageLol); var outputJson = CoolUtil.jsonStringify(stageLol);
#if sys #if sys
@ -49,6 +54,8 @@ class StageOffsetSubstate extends MusicBeatSubstate
var mosPosOld:FlxPoint = new FlxPoint(); var mosPosOld:FlxPoint = new FlxPoint();
var sprOld:FlxPoint = new FlxPoint(); var sprOld:FlxPoint = new FlxPoint();
var char:BaseCharacter = null;
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
super.update(elapsed); super.update(elapsed);
@ -62,30 +69,24 @@ class StageOffsetSubstate extends MusicBeatSubstate
{ {
if (FlxG.mouse.justPressed) if (FlxG.mouse.justPressed)
{ {
sprOld.x = PlayState.instance.currentStage.getBoyfriend().x; for (thing in PlayState.instance.currentStage)
sprOld.y = PlayState.instance.currentStage.getBoyfriend().y; {
if (FlxG.mouse.overlaps(thing) && Std.isOfType(thing, BaseCharacter))
char = cast thing;
}
sprOld.x = char.x;
sprOld.y = char.y;
mosPosOld.x = FlxG.mouse.x; mosPosOld.x = FlxG.mouse.x;
mosPosOld.y = FlxG.mouse.y; mosPosOld.y = FlxG.mouse.y;
} }
PlayState.instance.currentStage.getBoyfriend().x = sprOld.x - (mosPosOld.x - FlxG.mouse.x); if (char != null)
PlayState.instance.currentStage.getBoyfriend().y = sprOld.y - (mosPosOld.y - FlxG.mouse.y);
}
if (FlxG.mouse.pressedRight)
{
if (FlxG.mouse.justPressedRight)
{ {
sprOld.x = PlayState.instance.currentStage.getDad().x; char.x = sprOld.x - (mosPosOld.x - FlxG.mouse.x);
sprOld.y = PlayState.instance.currentStage.getDad().y; char.y = sprOld.y - (mosPosOld.y - FlxG.mouse.y);
mosPosOld.x = FlxG.mouse.x;
mosPosOld.y = FlxG.mouse.y;
} }
PlayState.instance.currentStage.getDad().x = sprOld.x - (mosPosOld.x - FlxG.mouse.x);
PlayState.instance.currentStage.getDad().y = sprOld.y - (mosPosOld.y - FlxG.mouse.y);
} }
if (FlxG.keys.justPressed.Y) if (FlxG.keys.justPressed.Y)