1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-25 22:47:52 +00:00

0.2.8 character positions, dont multiply zoom, chara scaling fix

This commit is contained in:
MtH 2022-05-07 18:45:49 +02:00
parent bfce579cd5
commit 8e2eefb605
3 changed files with 27 additions and 38 deletions

View file

@ -650,7 +650,7 @@ class PlayState extends MusicBeatState implements IHook
ScriptEventDispatcher.callEvent(currentStage, event);
// Apply camera zoom.
defaultCameraZoom *= currentStage.camZoom;
defaultCameraZoom = currentStage.camZoom;
// Add the stage to the scene.
this.add(currentStage);

View file

@ -156,9 +156,13 @@ class BaseCharacter extends Bopper
if (scale == null)
scale = 1.0;
var feetPos:FlxPoint = feetPosition;
this.scale.x = scale;
this.scale.y = scale;
this.updateHitbox();
// Reposition with newly scaled sprite.
this.x = feetPos.x - characterOrigin.x + globalOffsets[0];
this.y = feetPos.y - characterOrigin.y + globalOffsets[1];
}
/**

View file

@ -9,6 +9,7 @@ import funkin.modding.IScriptedClass;
import funkin.modding.events.ScriptEvent;
import funkin.modding.events.ScriptEventDispatcher;
import funkin.play.character.BaseCharacter;
import funkin.play.stage.StageData.StageDataCharacter;
import funkin.play.stage.StageData.StageDataParser;
import funkin.util.SortUtil;
import funkin.util.assets.FlxAnimationUtil;
@ -256,56 +257,40 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
#end
// Apply position and z-index.
var charData:StageDataCharacter = null;
switch (charType)
{
case BF:
this.characters.set("bf", character);
character.zIndex = _data.characters.bf.zIndex;
// Start with the per-stage character position.
// Subtracting the origin ensures characters are positioned relative to their feet.
// Subtracting the global offset allows positioning on a per-character basis.
character.x = _data.characters.bf.position[0] - character.characterOrigin.x + character.globalOffsets[0];
character.y = _data.characters.bf.position[1] - character.characterOrigin.y + character.globalOffsets[1];
character.cameraFocusPoint.x += _data.characters.bf.cameraOffsets[0];
character.cameraFocusPoint.y += _data.characters.bf.cameraOffsets[1];
debugIcon.x = _data.characters.bf.position[0];
debugIcon.y = _data.characters.bf.position[1];
charData = _data.characters.bf;
character.initHealthIcon(false);
case GF:
this.characters.set("gf", character);
character.zIndex = _data.characters.gf.zIndex;
character.x = _data.characters.gf.position[0] - character.characterOrigin.x + character.globalOffsets[0];
character.y = _data.characters.gf.position[1] - character.characterOrigin.y + character.globalOffsets[1];
character.cameraFocusPoint.x += _data.characters.gf.cameraOffsets[0];
character.cameraFocusPoint.y += _data.characters.gf.cameraOffsets[1];
// Draw the debug icon at the character's feet.
debugIcon.x = _data.characters.gf.position[0];
debugIcon.y = _data.characters.gf.position[1];
charData = _data.characters.gf;
case DAD:
this.characters.set("dad", character);
character.zIndex = _data.characters.dad.zIndex;
character.x = _data.characters.dad.position[0] - character.characterOrigin.x + character.globalOffsets[0];
character.y = _data.characters.dad.position[1] - character.characterOrigin.y + character.globalOffsets[1];
character.cameraFocusPoint.x += _data.characters.dad.cameraOffsets[0];
character.cameraFocusPoint.y += _data.characters.dad.cameraOffsets[1];
// Draw the debug icon at the character's feet.
debugIcon.x = _data.characters.dad.position[0];
debugIcon.y = _data.characters.dad.position[1];
charData = _data.characters.dad;
character.initHealthIcon(true);
default:
this.characters.set(character.characterId, character);
}
if (charData != null)
{
character.zIndex = charData.zIndex;
// Start with the per-stage character position.
// Subtracting the origin ensures characters are positioned relative to their feet.
// Subtracting the global offset allows positioning on a per-character basis.
character.x = charData.position[0] - character.characterOrigin.x + character.globalOffsets[0];
character.y = charData.position[1] - character.characterOrigin.y + character.globalOffsets[1];
character.cameraFocusPoint.x += charData.cameraOffsets[0];
character.cameraFocusPoint.y += charData.cameraOffsets[1];
// Draw the debug icon at the character's feet.
debugIcon.x = charData.position[0];
debugIcon.y = charData.position[1];
}
// Add the character to the scene.
this.add(character);