mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 03:13:45 +00:00
Merge pull request #805 from FunkinCrew/bugfix/two-fixes
[PUBLIC PR] Two bug fixes
This commit is contained in:
commit
84ff83759f
|
@ -430,12 +430,13 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
* @param autoDestroy Whether to destroy this sound when it finishes playing.
|
||||
* Leave this value set to `false` if you want to re-use this `FunkinSound` instance.
|
||||
* @param autoPlay Whether to play the sound immediately or wait for a `play()` call.
|
||||
* @param persist Whether to keep this `FunkinSound` between states, or destroy it.
|
||||
* @param onComplete Called when the sound finished playing.
|
||||
* @param onLoad Called when the sound finished loading. Called immediately for succesfully loaded embedded sounds.
|
||||
* @return A `FunkinSound` object, or `null` if the sound could not be loaded.
|
||||
*/
|
||||
public static function load(embeddedSound:FlxSoundAsset, volume:Float = 1.0, looped:Bool = false, autoDestroy:Bool = false, autoPlay:Bool = false,
|
||||
?onComplete:Void->Void, ?onLoad:Void->Void):Null<FunkinSound>
|
||||
persist:Bool = false, ?onComplete:Void->Void, ?onLoad:Void->Void):Null<FunkinSound>
|
||||
{
|
||||
@:privateAccess
|
||||
if (SoundMixer.__soundChannels.length >= SoundMixer.MAX_ACTIVE_CHANNELS)
|
||||
|
@ -462,7 +463,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
if (autoPlay) sound.play();
|
||||
sound.volume = volume;
|
||||
sound.group = FlxG.sound.defaultSoundGroup;
|
||||
sound.persist = true;
|
||||
sound.persist = persist;
|
||||
|
||||
// Make sure to add the sound to the list.
|
||||
// If it's already in, it won't get re-added.
|
||||
|
|
|
@ -233,15 +233,9 @@ class BaseCharacter extends Bopper
|
|||
*/
|
||||
public function resetCharacter(resetCamera:Bool = true):Void
|
||||
{
|
||||
// Reset the animation offsets. This will modify x and y to be the absolute position of the character.
|
||||
// this.animOffsets = [0, 0];
|
||||
|
||||
// Now we can set the x and y to be their original values without having to account for animOffsets.
|
||||
// Set the x and y to be their original values.
|
||||
this.resetPosition();
|
||||
|
||||
// Then reapply animOffsets...
|
||||
// applyAnimationOffsets(getCurrentAnimation());
|
||||
|
||||
this.dance(true); // Force to avoid the old animation playing with the wrong offset at the start of the song.
|
||||
// Make sure we are playing the idle animation
|
||||
// ...then update the hitbox so that this.width and this.height are correct.
|
||||
|
|
|
@ -150,11 +150,8 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
*/
|
||||
public function resetPosition()
|
||||
{
|
||||
var oldAnimOffsets = [animOffsets[0], animOffsets[1]];
|
||||
animOffsets = [0, 0];
|
||||
this.x = originalPosition.x;
|
||||
this.y = originalPosition.y;
|
||||
animOffsets = oldAnimOffsets;
|
||||
}
|
||||
|
||||
function update_shouldAlternate():Void
|
||||
|
|
|
@ -443,12 +443,7 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
|
|||
character.x = stageCharData.position[0] - character.characterOrigin.x;
|
||||
character.y = stageCharData.position[1] - character.characterOrigin.y;
|
||||
|
||||
@:privateAccess(funkin.play.stage.Bopper)
|
||||
{
|
||||
// Undo animOffsets before saving original position.
|
||||
character.originalPosition.x = character.x + character.animOffsets[0];
|
||||
character.originalPosition.y = character.y + character.animOffsets[1];
|
||||
}
|
||||
character.originalPosition.set(character.x, character.y);
|
||||
|
||||
var finalScale = character.getBaseScale() * stageCharData.scale;
|
||||
character.setScale(finalScale); // Don't use scale.set for characters!
|
||||
|
|
Loading…
Reference in a new issue