mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
Merge branch 'master' of github.com:ninjamuffin99/Funkin-secret into nitpix
This commit is contained in:
commit
b2cff72608
6 changed files with 218 additions and 106 deletions
|
@ -126,6 +126,12 @@
|
|||
<haxelib name="faxe" if='switch'/>
|
||||
<haxelib name="polymod"/>
|
||||
<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="hxcpp-debug-server" if="desktop"/> -->
|
||||
|
||||
|
|
|
@ -63,63 +63,4 @@ class CoolUtil
|
|||
{
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package;
|
||||
|
||||
import animate.FlxAnimate;
|
||||
import animateAtlasPlayer.assets.AssetManager;
|
||||
import animateAtlasPlayer.core.Animation;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
|
@ -8,6 +11,7 @@ import flixel.group.FlxGroup.FlxTypedGroup;
|
|||
import flixel.math.FlxPoint;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.util.FlxColor;
|
||||
import openfl.display.BitmapData;
|
||||
|
||||
class CutsceneAnimTestState extends FlxState
|
||||
{
|
||||
|
@ -38,17 +42,8 @@ class CutsceneAnimTestState extends FlxState
|
|||
debugTxt.color = FlxColor.BLUE;
|
||||
add(debugTxt);
|
||||
|
||||
for (i in 0...animShit.length)
|
||||
{
|
||||
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);
|
||||
var animated:FlxAnimate = new FlxAnimate(10, 10);
|
||||
add(animated);
|
||||
|
||||
// createCutscene(0);
|
||||
// createCutscene(1);
|
||||
|
@ -59,36 +54,37 @@ class CutsceneAnimTestState extends FlxState
|
|||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (FlxG.keys.pressed.SHIFT)
|
||||
{
|
||||
if (FlxG.keys.justPressed.UP)
|
||||
curSelected -= 1;
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
curSelected += 1;
|
||||
/* if (FlxG.keys.pressed.SHIFT)
|
||||
{
|
||||
if (FlxG.keys.justPressed.UP)
|
||||
curSelected -= 1;
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
curSelected += 1;
|
||||
|
||||
if (curSelected < 0)
|
||||
curSelected = cutsceneGroup.members.length - 1;
|
||||
if (curSelected >= cutsceneGroup.members.length)
|
||||
curSelected = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
var valueMulti:Float = 1;
|
||||
if (curSelected < 0)
|
||||
curSelected = cutsceneGroup.members.length - 1;
|
||||
if (curSelected >= cutsceneGroup.members.length)
|
||||
curSelected = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
var valueMulti:Float = 1;
|
||||
|
||||
if (FlxG.keys.pressed.SPACE)
|
||||
valueMulti = 10;
|
||||
if (FlxG.keys.pressed.SPACE)
|
||||
valueMulti = 10;
|
||||
|
||||
if (FlxG.keys.justPressed.UP)
|
||||
cutsceneGroup.members[curSelected].y -= valueMulti;
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
cutsceneGroup.members[curSelected].y += valueMulti;
|
||||
if (FlxG.keys.justPressed.LEFT)
|
||||
cutsceneGroup.members[curSelected].x -= valueMulti;
|
||||
if (FlxG.keys.justPressed.RIGHT)
|
||||
cutsceneGroup.members[curSelected].x += valueMulti;
|
||||
}
|
||||
if (FlxG.keys.justPressed.UP)
|
||||
cutsceneGroup.members[curSelected].y -= valueMulti;
|
||||
if (FlxG.keys.justPressed.DOWN)
|
||||
cutsceneGroup.members[curSelected].y += valueMulti;
|
||||
if (FlxG.keys.justPressed.LEFT)
|
||||
cutsceneGroup.members[curSelected].x -= valueMulti;
|
||||
if (FlxG.keys.justPressed.RIGHT)
|
||||
cutsceneGroup.members[curSelected].x += valueMulti;
|
||||
}
|
||||
|
||||
debugTxt.text = curSelected + " : " + cutsceneGroup.members[curSelected].getPosition();
|
||||
debugTxt.text = curSelected + " : " + cutsceneGroup.members[curSelected].getPosition();
|
||||
*/
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package;
|
|||
import Section.SwagSection;
|
||||
import Song.SwagSong;
|
||||
import WiggleEffect.WiggleEffectType;
|
||||
import animateAtlasPlayer.assets.AssetManager;
|
||||
import animateAtlasPlayer.core.Animation;
|
||||
import flixel.FlxBasic;
|
||||
import flixel.FlxCamera;
|
||||
import flixel.FlxG;
|
||||
|
@ -37,6 +39,7 @@ import flixel.util.FlxTimer;
|
|||
import haxe.Json;
|
||||
import lime.utils.Assets;
|
||||
import openfl.Lib;
|
||||
import openfl.display.BitmapData;
|
||||
import openfl.display.BlendMode;
|
||||
import openfl.display.StageQuality;
|
||||
import openfl.filters.ShaderFilter;
|
||||
|
@ -1062,16 +1065,18 @@ class PlayState extends MusicBeatState
|
|||
var dummyLoaderShit:FlxGroup = new FlxGroup();
|
||||
|
||||
add(dummyLoaderShit);
|
||||
/*
|
||||
for (i in 0...7)
|
||||
{
|
||||
var dummyLoader:FlxSprite = new FlxSprite();
|
||||
dummyLoader.loadGraphic(Paths.image('cutsceneStuff/gfHoldup-' + i));
|
||||
dummyLoaderShit.add(dummyLoader);
|
||||
dummyLoader.alpha = 0.01;
|
||||
dummyLoader.y = FlxG.height - 20;
|
||||
// dummyLoader.drawFrame(true);
|
||||
}
|
||||
|
||||
for (i in 0...7)
|
||||
{
|
||||
var dummyLoader:FlxSprite = new FlxSprite();
|
||||
dummyLoader.loadGraphic(Paths.image('cutsceneStuff/gfHoldup-' + i));
|
||||
dummyLoaderShit.add(dummyLoader);
|
||||
dummyLoader.alpha = 0.01;
|
||||
dummyLoader.y = FlxG.height - 20;
|
||||
// dummyLoader.drawFrame(true);
|
||||
}
|
||||
*/
|
||||
|
||||
dad.visible = false;
|
||||
|
||||
|
@ -1111,6 +1116,21 @@ class PlayState extends MusicBeatState
|
|||
var fakeBF:Character = new Character(boyfriend.x, boyfriend.y, 'bf', true);
|
||||
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);
|
||||
bfCatchGf.frames = Paths.getSparrowAtlas('cutsceneStuff/bfCatchesGF');
|
||||
bfCatchGf.animation.addByPrefix('catch', 'BF catches GF', 24, false);
|
||||
|
|
|
@ -376,6 +376,11 @@ class TitleState extends MusicBeatState
|
|||
}
|
||||
#end
|
||||
|
||||
if (FlxG.keys.justPressed.FIVE)
|
||||
{
|
||||
FlxG.switchState(new CutsceneAnimTestState());
|
||||
}
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
|
|
144
source/animate/FlxAnimate.hx
Normal file
144
source/animate/FlxAnimate.hx
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue