Multi Spritesheets + Bug Fixes
This commit is contained in:
@@ -25,7 +25,7 @@ class FlxAnimate extends flxanimate.FlxAnimate {
|
||||
|
||||
getScreenPosition(_point, camera).subtractPoint(offset);
|
||||
rMatrix.translate(-origin.x, -origin.y);
|
||||
if (!showPivot && limb.name != "pivot") {
|
||||
if (limb != _pivot) {
|
||||
if (frameOffsetAngle != null && frameOffsetAngle != angle)
|
||||
{
|
||||
var angleOff = (-angle + frameOffsetAngle) * FlxAngle.TO_RAD;
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package funkin.backend.assets;
|
||||
|
||||
import flixel.graphics.frames.FlxFramesCollection;
|
||||
import flixel.FlxG;
|
||||
import flixel.graphics.FlxGraphic;
|
||||
import flixel.graphics.frames.FlxFrame.FlxFrameAngle;
|
||||
import flixel.graphics.frames.FlxFrame.FlxFrameType;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.math.FlxRect;
|
||||
import flixel.util.FlxDestroyUtil;
|
||||
import flixel.util.FlxStringUtil;
|
||||
|
||||
/**
|
||||
* Base class for all frame collections.
|
||||
*/
|
||||
class MultiFramesCollection extends FlxFramesCollection
|
||||
{
|
||||
public var parentedFrames:Array<FlxFramesCollection> = [];
|
||||
|
||||
public function new(parent:FlxGraphic, ?border:FlxPoint)
|
||||
{
|
||||
super(parent, USER("MULTI"), border);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the `FlxAtlasFrame` of the specified `FlxGraphic` object.
|
||||
*
|
||||
* @param graphic `FlxGraphic` object to find the `FlxAtlasFrames` collection for.
|
||||
* @return `FlxAtlasFrames` collection for the specified `FlxGraphic` object
|
||||
* Could be `null` if `FlxGraphic` doesn't have it yet.
|
||||
*/
|
||||
public static function findFrame(graphic:FlxGraphic, ?border:FlxPoint):MultiFramesCollection
|
||||
{
|
||||
if (border == null)
|
||||
border = FlxPoint.weak();
|
||||
|
||||
var atlasFrames:Array<MultiFramesCollection> = cast graphic.getFramesCollections(USER("MULTI"));
|
||||
|
||||
for (atlas in atlasFrames)
|
||||
if (atlas.border.equals(border))
|
||||
return atlas;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function addFrames(collection:FlxFramesCollection) {
|
||||
if (collection == null || collection.frames == null) return;
|
||||
|
||||
collection.parent.useCount++;
|
||||
parentedFrames.push(collection);
|
||||
|
||||
for(f in collection.frames) {
|
||||
if (f != null) {
|
||||
pushFrame(f);
|
||||
f.parent = collection.parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override function destroy():Void
|
||||
{
|
||||
if(parentedFrames != null) {
|
||||
for(collection in parentedFrames) {
|
||||
if(collection != null)
|
||||
collection.parent.useCount--;
|
||||
}
|
||||
parentedFrames = null;
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
@@ -199,25 +199,18 @@ class Paths
|
||||
// MULTIPLE SPRITESHEETS!!
|
||||
|
||||
var graphic = FlxG.bitmap.add("flixel/images/logo/default.png", false, '$noExt/mult');
|
||||
var frames = FlxAtlasFrames.findFrame(graphic);
|
||||
var frames = MultiFramesCollection.findFrame(graphic);
|
||||
if (frames != null)
|
||||
return frames;
|
||||
|
||||
trace("no frames yet for multiple atlases!!");
|
||||
var spritesheets = [];
|
||||
var cur = 1;
|
||||
var finalFrames = new FlxFramesCollection(graphic, ATLAS);
|
||||
var finalFrames = new MultiFramesCollection(graphic);
|
||||
while(Assets.exists('$noExt/$cur.png')) {
|
||||
spritesheets.push(loadFrames('$noExt/$cur.png'));
|
||||
var spr = loadFrames('$noExt/$cur.png');
|
||||
finalFrames.addFrames(spr);
|
||||
cur++;
|
||||
}
|
||||
for(frames in spritesheets)
|
||||
if (frames != null && frames.frames != null)
|
||||
for(f in frames.frames)
|
||||
if (f != null) {
|
||||
finalFrames.frames.push(f);
|
||||
f.parent = frames.parent;
|
||||
}
|
||||
return finalFrames;
|
||||
} else if (Assets.exists('$noExt.xml')) {
|
||||
return Paths.getSparrowAtlasAlt(noExt);
|
||||
|
||||
@@ -1486,7 +1486,7 @@ class PlayState extends MusicBeatState
|
||||
if (event.showRating || (event.showRating == null && event.player))
|
||||
{
|
||||
displayCombo(event);
|
||||
displayRating(daRating, event);
|
||||
displayRating(event.rating, event);
|
||||
ratingNum += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user