Merge branch 'master' of github.com:ninjamuffin99/Funkin-secret into nitpix

This commit is contained in:
MtH 2021-04-14 04:05:05 +02:00
commit b2cff72608
6 changed files with 218 additions and 106 deletions

View file

@ -126,6 +126,12 @@
<haxelib name="faxe" if='switch'/> <haxelib name="faxe" if='switch'/>
<haxelib name="polymod"/> <haxelib name="polymod"/>
<haxelib name="hxcpp-debug-server" if="desktop debug"/> <haxelib name="hxcpp-debug-server" if="desktop debug"/>
<haxelib name="flixel-animate" />
<haxelib name="spinehaxe" />
<!-- https://github.com/ninjamuffin99/Flixel-Animate-Atlas-Player -->
<!--<haxelib name="discord_rpc" if="cpp"/> --> <!-- foesn't work with neko --> <!--<haxelib name="discord_rpc" if="cpp"/> --> <!-- foesn't work with neko -->
<!-- <haxelib name="hxcpp-debug-server" if="desktop"/> --> <!-- <haxelib name="hxcpp-debug-server" if="desktop"/> -->

View file

@ -63,63 +63,4 @@ class CoolUtil
{ {
return FlxMath.lerp(a, b, camLerpShit(ratio)); return FlxMath.lerp(a, b, camLerpShit(ratio));
} }
public static function fromAnimate(Source:FlxGraphicAsset, Description:String):FlxAtlasFrames
{
var graphic:FlxGraphic = FlxG.bitmap.add(Source);
if (graphic == null)
return null;
var frames:FlxAtlasFrames = FlxAtlasFrames.findFrame(graphic);
if (frames != null)
return frames;
if (graphic == null || Description == null)
return null;
frames = new FlxAtlasFrames(graphic);
var data:AnimateObject;
var json:String = Description;
trace(json);
if (Assets.exists(json))
json = Assets.getText(json);
data = cast Json.parse(json).ATLAS;
for (sprite in data.SPRITES)
{
// probably nicer way to do this? Oh well
var swagSprite:AnimateSprite = sprite.SPRITE;
var rect = FlxRect.get(swagSprite.x, swagSprite.y, swagSprite.w, swagSprite.h);
var size = new Rectangle(0, 0, rect.width, rect.height);
var offset = FlxPoint.get(-size.left, -size.top);
var sourceSize = FlxPoint.get(size.width, size.height);
frames.addAtlasFrame(rect, sourceSize, offset, swagSprite.name);
}
return frames;
}
}
typedef AnimateObject =
{
SPRITES:Array<Dynamic>
}
typedef AnimateSprite =
{
var name:String;
var x:Int;
var y:Int;
var w:Int;
var h:Int;
var rotated:Bool;
} }

View file

@ -1,5 +1,8 @@
package; package;
import animate.FlxAnimate;
import animateAtlasPlayer.assets.AssetManager;
import animateAtlasPlayer.core.Animation;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.FlxState; import flixel.FlxState;
@ -8,6 +11,7 @@ import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxPoint; import flixel.math.FlxPoint;
import flixel.text.FlxText; import flixel.text.FlxText;
import flixel.util.FlxColor; import flixel.util.FlxColor;
import openfl.display.BitmapData;
class CutsceneAnimTestState extends FlxState class CutsceneAnimTestState extends FlxState
{ {
@ -38,17 +42,8 @@ class CutsceneAnimTestState extends FlxState
debugTxt.color = FlxColor.BLUE; debugTxt.color = FlxColor.BLUE;
add(debugTxt); add(debugTxt);
for (i in 0...animShit.length) var animated:FlxAnimate = new FlxAnimate(10, 10);
{ add(animated);
var dummyLoader:FlxSprite = new FlxSprite();
dummyLoader.loadGraphic(Paths.image('cutsceneStuff/gfHoldup-' + i));
add(dummyLoader);
dummyLoader.alpha = 0.01;
dummyLoader.y = FlxG.height - 20;
}
cutsceneGroup = new CutsceneCharacter(0, 0, 'gfHoldup');
add(cutsceneGroup);
// createCutscene(0); // createCutscene(0);
// createCutscene(1); // createCutscene(1);
@ -59,7 +54,7 @@ class CutsceneAnimTestState extends FlxState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
if (FlxG.keys.pressed.SHIFT) /* if (FlxG.keys.pressed.SHIFT)
{ {
if (FlxG.keys.justPressed.UP) if (FlxG.keys.justPressed.UP)
curSelected -= 1; curSelected -= 1;
@ -89,6 +84,7 @@ class CutsceneAnimTestState extends FlxState
} }
debugTxt.text = curSelected + " : " + cutsceneGroup.members[curSelected].getPosition(); debugTxt.text = curSelected + " : " + cutsceneGroup.members[curSelected].getPosition();
*/
super.update(elapsed); super.update(elapsed);
} }

View file

@ -3,6 +3,8 @@ package;
import Section.SwagSection; import Section.SwagSection;
import Song.SwagSong; import Song.SwagSong;
import WiggleEffect.WiggleEffectType; import WiggleEffect.WiggleEffectType;
import animateAtlasPlayer.assets.AssetManager;
import animateAtlasPlayer.core.Animation;
import flixel.FlxBasic; import flixel.FlxBasic;
import flixel.FlxCamera; import flixel.FlxCamera;
import flixel.FlxG; import flixel.FlxG;
@ -37,6 +39,7 @@ import flixel.util.FlxTimer;
import haxe.Json; import haxe.Json;
import lime.utils.Assets; import lime.utils.Assets;
import openfl.Lib; import openfl.Lib;
import openfl.display.BitmapData;
import openfl.display.BlendMode; import openfl.display.BlendMode;
import openfl.display.StageQuality; import openfl.display.StageQuality;
import openfl.filters.ShaderFilter; import openfl.filters.ShaderFilter;
@ -1062,7 +1065,7 @@ class PlayState extends MusicBeatState
var dummyLoaderShit:FlxGroup = new FlxGroup(); var dummyLoaderShit:FlxGroup = new FlxGroup();
add(dummyLoaderShit); add(dummyLoaderShit);
/*
for (i in 0...7) for (i in 0...7)
{ {
var dummyLoader:FlxSprite = new FlxSprite(); var dummyLoader:FlxSprite = new FlxSprite();
@ -1073,6 +1076,8 @@ class PlayState extends MusicBeatState
// dummyLoader.drawFrame(true); // dummyLoader.drawFrame(true);
} }
*/
dad.visible = false; dad.visible = false;
// gf.y += 300; // gf.y += 300;
@ -1111,6 +1116,21 @@ class PlayState extends MusicBeatState
var fakeBF:Character = new Character(boyfriend.x, boyfriend.y, 'bf', true); var fakeBF:Character = new Character(boyfriend.x, boyfriend.y, 'bf', true);
bfTankCutsceneLayer.add(fakeBF); bfTankCutsceneLayer.add(fakeBF);
// var atlasCutscene:Animation
// var animAssets:AssetManager = new AssetManager();
// var url = 'images/gfDemon';
// // animAssets.enqueueSingle(Paths.file(url + "/spritemap1.png"));
// // animAssets.enqueueSingle(Paths.file(url + "/spritemap1.json"));
// // animAssets.enqueueSingle(Paths.file(url + "/Animation.json"));
// animAssets.loadQueue(function(asssss:AssetManager)
// {
// var daAnim:Animation = asssss.createAnimation('GF Turnin Demon W Effect');
// FlxG.addChildBelowMouse(daAnim);
// });
var bfCatchGf:FlxSprite = new FlxSprite(boyfriend.x - 10, boyfriend.y - 90); var bfCatchGf:FlxSprite = new FlxSprite(boyfriend.x - 10, boyfriend.y - 90);
bfCatchGf.frames = Paths.getSparrowAtlas('cutsceneStuff/bfCatchesGF'); bfCatchGf.frames = Paths.getSparrowAtlas('cutsceneStuff/bfCatchesGF');
bfCatchGf.animation.addByPrefix('catch', 'BF catches GF', 24, false); bfCatchGf.animation.addByPrefix('catch', 'BF catches GF', 24, false);

View file

@ -376,6 +376,11 @@ class TitleState extends MusicBeatState
} }
#end #end
if (FlxG.keys.justPressed.FIVE)
{
FlxG.switchState(new CutsceneAnimTestState());
}
var gamepad:FlxGamepad = FlxG.gamepads.lastActive; var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null) if (gamepad != null)

View file

@ -0,0 +1,144 @@
package animate;
import animateAtlasPlayer.assets.AssetManager;
import animateAtlasPlayer.core.Animation;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.system.FlxAssets.FlxGraphicAsset;
import haxe.Json;
import openfl.Assets;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.geom.Point;
import openfl.geom.Rectangle;
class FlxAnimate extends FlxSprite
{
var myAnim:Animation;
var animBitmap:BitmapData;
var loadedQueue:Bool = false;
var swagFrames:Array<BitmapData> = [];
public function new(x:Float, y:Float)
{
super(x, y);
// get fromAnimate()
// get every symbol / piece needed
// animate them?
var swagAssets:AssetManager = new AssetManager();
swagAssets.enqueueSingle(Paths.file('images/picoShoot/spritemap1.png'));
swagAssets.enqueueSingle(Paths.file('images/picoShoot/spritemap1.json'));
swagAssets.enqueueSingle(Paths.file('images/picoShoot/Animation.json'));
swagAssets.loadQueue(function(assetMgr:AssetManager)
{
myAnim = assetMgr.createAnimation("Pico Saves them sequence");
myAnim.cacheAsBitmap = true;
myAnim.opaqueBackground = null;
// myAnim.root.x += 200;
// myAnim.root.y += 200;
// myAnim.x += 200;
// myAnim.y += 200;
var daAnim:BitmapData = new BitmapData(200, 200, true, 0x00000000);
daAnim.draw(myAnim);
animBitmap = new BitmapData(200, 200, true, 0x00000000);
animBitmap.draw(myAnim);
loadGraphic(animBitmap);
// framePixels = animBitmap;
loadedQueue = true;
});
}
var pointZero:Point = new Point();
private var lastFrame:Int = 0;
override function draw()
{
super.draw();
if (loadedQueue)
{
if (lastFrame != myAnim.currentFrame)
{
lastFrame = myAnim.currentFrame;
// loadGraphic(animBitmap);
animBitmap.draw(myAnim);
}
// animBitmap.draw(myAnim);
}
}
// This stuff is u
public static function fromAnimate(Source:FlxGraphicAsset, Description:String):FlxAtlasFrames
{
var graphic:FlxGraphic = FlxG.bitmap.add(Source);
if (graphic == null)
return null;
var frames:FlxAtlasFrames = FlxAtlasFrames.findFrame(graphic);
if (frames != null)
return frames;
if (graphic == null || Description == null)
return null;
frames = new FlxAtlasFrames(graphic);
var data:AnimateObject;
var json:String = Description;
trace(json);
if (Assets.exists(json))
json = Assets.getText(json);
data = cast Json.parse(json).ATLAS;
for (sprite in data.SPRITES)
{
// probably nicer way to do this? Oh well
var swagSprite:AnimateSprite = sprite.SPRITE;
var rect = FlxRect.get(swagSprite.x, swagSprite.y, swagSprite.w, swagSprite.h);
var size = new Rectangle(0, 0, rect.width, rect.height);
var offset = FlxPoint.get(-size.left, -size.top);
var sourceSize = FlxPoint.get(size.width, size.height);
frames.addAtlasFrame(rect, sourceSize, offset, swagSprite.name);
}
return frames;
}
}
typedef AnimateObject =
{
SPRITES:Array<Dynamic>
}
typedef AnimateSprite =
{
var name:String;
var x:Int;
var y:Int;
var w:Int;
var h:Int;
var rotated:Bool;
}