fixed animation bug
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
1216
|
||||
1225
|
||||
@@ -241,6 +241,7 @@ class SpriteSymbol extends Sprite {
|
||||
_bitmap = new Bitmap(new BitmapData(1, 1), PixelSnapping.AUTO, smoothing);
|
||||
addChild(_bitmap);
|
||||
}
|
||||
if (spriteData == null) return;
|
||||
|
||||
if (_tempRect.x != spriteData.x || _tempRect.y != spriteData.y || _tempRect.width != spriteData.w || _tempRect.height != spriteData.h) {
|
||||
var clippedTexture = new BitmapData(spriteData.w, spriteData.h);
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package funkin.cutscenes;
|
||||
|
||||
import funkin.scripting.DummyScript;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import funkin.scripting.Script;
|
||||
|
||||
class ScriptedCutscene extends Cutscene {
|
||||
var script:Script;
|
||||
|
||||
var scriptPath:String;
|
||||
public function new(scriptPath:String, callback:Void->Void) {
|
||||
super(callback);
|
||||
|
||||
script = Script.create(scriptPath);
|
||||
script = Script.create(this.scriptPath = scriptPath);
|
||||
script.setPublicMap(PlayState.instance.scripts.publicVariables);
|
||||
script.setParent(this);
|
||||
script.load();
|
||||
@@ -16,7 +19,12 @@ class ScriptedCutscene extends Cutscene {
|
||||
|
||||
public override function create() {
|
||||
super.create();
|
||||
trace("fuck");
|
||||
script.call("create");
|
||||
if (Std.isOfType(script, DummyScript)) {
|
||||
Logs.trace('Could not find script for scripted cutscene at ${scriptPath}', ERROR, RED);
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
@@ -41,6 +49,7 @@ class ScriptedCutscene extends Cutscene {
|
||||
}
|
||||
|
||||
public function startVideo(path:String, ?callback:Void->Void) {
|
||||
persistentDraw = false;
|
||||
openSubState(new VideoCutscene(path, function() {
|
||||
if (callback != null)
|
||||
callback();
|
||||
|
||||
@@ -124,7 +124,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
|
||||
if (xml.has.antialiasing) antialiasing = (xml.att.antialiasing == "true");
|
||||
if (xml.has.sprite) sprite = xml.att.sprite;
|
||||
|
||||
frames = CoolUtil.loadFrames(Paths.image('characters/$sprite'));
|
||||
frames = CoolUtil.loadFrames(Paths.image('characters/$sprite', null, true));
|
||||
for(anim in xml.nodes.anim) {
|
||||
XMLUtil.addXMLAnimation(this, anim);
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ class PlayState extends MusicBeatState
|
||||
persistentUpdate = false;
|
||||
if (cutscene != null) {
|
||||
openSubState(new ScriptedCutscene(cutscene, function() {
|
||||
nextSong();
|
||||
startCountdown();
|
||||
}));
|
||||
} else if (Assets.exists(videoCutscene)) {
|
||||
FlxTransitionableState.skipNextTransIn = true;
|
||||
@@ -670,6 +670,9 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
var event = scripts.event("onSubstateOpen", new SubstateEvent(SubState));
|
||||
|
||||
if (!postCreated)
|
||||
FlxTransitionableState.skipNextTransIn = true;
|
||||
|
||||
if (event.cancelled) return;
|
||||
|
||||
if (paused)
|
||||
@@ -1314,31 +1317,29 @@ class PlayState extends MusicBeatState
|
||||
if (combo == 0 || combo >= 10) {
|
||||
comboGroup.add(comboSpr);
|
||||
for (i in 0...separatedScore.length)
|
||||
{
|
||||
break;
|
||||
|
||||
var e = separatedScore.charAt(i);
|
||||
|
||||
var numScore:FlxSprite = new FlxSprite((43 * i) - 90, 80).loadGraphic(Paths.image('${event.ratingPrefix}num$e${event.ratingSuffix}'));
|
||||
numScore.antialiasing = event.numAntialiasing;
|
||||
numScore.scale.set(event.numScale, event.numScale);
|
||||
numScore.updateHitbox();
|
||||
|
||||
numScore.acceleration.y = FlxG.random.int(200, 300);
|
||||
numScore.velocity.y -= FlxG.random.int(140, 160);
|
||||
numScore.velocity.x = FlxG.random.float(-5, 5);
|
||||
|
||||
comboGroup.add(numScore);
|
||||
|
||||
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
|
||||
onComplete: function(tween:FlxTween)
|
||||
{
|
||||
comboGroup.remove(numScore, true);
|
||||
numScore.destroy();
|
||||
},
|
||||
startDelay: Conductor.crochet * 0.002
|
||||
});
|
||||
}
|
||||
{
|
||||
var e = separatedScore.charAt(i);
|
||||
|
||||
var numScore:FlxSprite = new FlxSprite((43 * i) - 90, 80).loadGraphic(Paths.image('${event.ratingPrefix}num$e${event.ratingSuffix}'));
|
||||
numScore.antialiasing = event.numAntialiasing;
|
||||
numScore.scale.set(event.numScale, event.numScale);
|
||||
numScore.updateHitbox();
|
||||
|
||||
numScore.acceleration.y = FlxG.random.int(200, 300);
|
||||
numScore.velocity.y -= FlxG.random.int(140, 160);
|
||||
numScore.velocity.x = FlxG.random.float(-5, 5);
|
||||
|
||||
comboGroup.add(numScore);
|
||||
|
||||
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
|
||||
onComplete: function(tween:FlxTween)
|
||||
{
|
||||
comboGroup.remove(numScore, true);
|
||||
numScore.destroy();
|
||||
},
|
||||
startDelay: Conductor.crochet * 0.002
|
||||
});
|
||||
}
|
||||
}
|
||||
comboGroup.add(rating);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class Stage extends FlxBasic implements IBeatReceiver {
|
||||
|
||||
if (!node.has.sprite || !node.has.name || !node.has.x || !node.has.y) continue;
|
||||
|
||||
spr.loadAnimatedGraphic(Paths.image('$spritesParentFolder${node.att.sprite}'));
|
||||
spr.loadAnimatedGraphic(Paths.image('$spritesParentFolder${node.att.sprite}', null, true));
|
||||
|
||||
var x:Null<Float> = Std.parseFloat(node.att.x);
|
||||
var y:Null<Float> = Std.parseFloat(node.att.y);
|
||||
|
||||
@@ -367,7 +367,7 @@ class MenuItem extends FlxSprite
|
||||
public function new(x:Float, y:Float, path:String)
|
||||
{
|
||||
super(x, y);
|
||||
CoolUtil.loadAnimatedGraphic(this, Paths.image(path));
|
||||
CoolUtil.loadAnimatedGraphic(this, Paths.image(path, null, true));
|
||||
screenCenter(X);
|
||||
antialiasing = true;
|
||||
}
|
||||
|
||||
@@ -111,9 +111,10 @@ class Paths
|
||||
return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC, null);
|
||||
}
|
||||
|
||||
inline static public function image(key:String, ?library:String)
|
||||
inline static public function image(key:String, ?library:String, checkForAtlas:Bool = false)
|
||||
{
|
||||
return getPath('images/$key.png', IMAGE, library);
|
||||
var atlasPath = checkForAtlas ? getPath('images/$key/spritemap.png', IMAGE, library) : null;
|
||||
return (checkForAtlas && OpenFlAssets.exists(atlasPath)) ? atlasPath.substr(0, atlasPath.length - 14) : getPath('images/$key.png', IMAGE, library);
|
||||
}
|
||||
|
||||
inline static public function script(key:String, ?library:String, isAssetsPath:Bool = false) {
|
||||
|
||||
Reference in New Issue
Block a user