1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-05 06:14:36 +00:00

cutscene character work in progress

This commit is contained in:
Cameron Taylor 2021-04-06 18:12:31 -04:00
parent c99297cc14
commit 3db5184b71
3 changed files with 166 additions and 4 deletions

View file

@ -0,0 +1,96 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.addons.display.FlxGridOverlay;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxPoint;
import flixel.text.FlxText;
import flixel.util.FlxColor;
class CutsceneAnimTestState extends FlxState
{
var animShit:Array<String> = [
'GF STARTS TO TURN PART 1',
'GF STARTS TO TURN PART 2',
'PICO ARRIVES PART 1',
'PICO ARRIVES PART 2',
'PICO ARRIVES PART 2 POINT FIVE'
];
var coolPosition:FlxPoint = FlxPoint.get(0, 100);
var cutsceneGroup:CutsceneCharacter;
var curSelected:Int = 0;
var debugTxt:FlxText;
public function new()
{
super();
var gridBG:FlxSprite = FlxGridOverlay.create(10, 10);
gridBG.scrollFactor.set(0.5, 0.5);
add(gridBG);
debugTxt = new FlxText(1000, 20, 0, "", 24);
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, 100, 'gfHoldup');
add(cutsceneGroup);
// createCutscene(0);
// createCutscene(1);
// createCutscene(2);
// createCutscene(3);
// createCutscene(4);
}
override function update(elapsed:Float)
{
if (FlxG.keys.pressed.SHIFT)
{
if (FlxG.keys.justPressed.UP)
curSelected -= 1;
if (FlxG.keys.justPressed.DOWN)
curSelected += 1;
}
else
{
var valueMulti:Float = 1;
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;
}
debugTxt.text = curSelected + " : " + cutsceneGroup.members[curSelected].getPosition();
if (curSelected < 0)
curSelected = animShit.length - 1;
if (curSelected >= animShit.length)
curSelected = 0;
super.update(elapsed);
}
}

View file

@ -0,0 +1,65 @@
package;
import flixel.FlxSprite;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxPoint;
using StringTools;
class CutsceneCharacter extends FlxTypedGroup<FlxSprite>
{
public var coolPos:FlxPoint = FlxPoint.get();
public var animShit:Map<String, FlxPoint> = new Map();
private var imageShit:String;
public function new(x:Float, y:Float, imageShit:String)
{
super();
coolPos.set(x, y);
this.imageShit = imageShit;
parseOffsets();
createCutscene(0);
}
// shitshow, oh well
var arrayLMFAOOOO:Array<String> = [];
function parseOffsets()
{
var splitShit:Array<String> = CoolUtil.coolTextFile(Paths.file('images/cutsceneStuff/' + imageShit + "CutsceneOffsets.txt"));
for (i in splitShit)
{
var xAndY:FlxPoint = FlxPoint.get();
var dumbSplit:Array<String> = i.split('---')[1].trim().split(' ');
xAndY.set(Std.parseFloat(dumbSplit[0]), Std.parseFloat(dumbSplit[1]));
animShit.set(i.split('---')[0].trim(), xAndY);
arrayLMFAOOOO.push(i.split('---')[0].trim());
}
trace(animShit);
}
public function createCutscene(daNum:Int = 0)
{
var cutScene:FlxSprite = new FlxSprite(coolPos.x + animShit.get(arrayLMFAOOOO[daNum]).x, coolPos.y + animShit.get(arrayLMFAOOOO[daNum]).y);
cutScene.frames = Paths.getSparrowAtlas('cutsceneStuff/' + imageShit + "-" + daNum);
cutScene.animation.addByPrefix('weed', arrayLMFAOOOO[daNum], 24, false);
cutScene.animation.play('weed');
cutScene.animation.finishCallback = function(anim:String)
{
cutScene.kill();
cutScene.destroy();
if (daNum + 1 < arrayLMFAOOOO.length)
createCutscene(daNum + 1);
};
add(cutScene);
}
}

View file

@ -44,13 +44,9 @@ class TitleState extends MusicBeatState
var ngSpr:FlxSprite; var ngSpr:FlxSprite;
var curWacky:Array<String> = []; var curWacky:Array<String> = [];
var wackyImage:FlxSprite; var wackyImage:FlxSprite;
var lastBeat:Int = 0; var lastBeat:Int = 0;
var swagShader:ColorSwap; var swagShader:ColorSwap;
var thingie:FlxSprite; var thingie:FlxSprite;
override public function create():Void override public function create():Void
@ -59,6 +55,7 @@ class TitleState extends MusicBeatState
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL}); polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL});
// FlxG.bitmap.clearCache(); // FlxG.bitmap.clearCache();
#end #end
/* /*
FlxG.stage.window.onDropFile.add(function(path:String) FlxG.stage.window.onDropFile.add(function(path:String)
@ -177,6 +174,7 @@ class TitleState extends MusicBeatState
logoBl.antialiasing = true; logoBl.antialiasing = true;
logoBl.animation.addByPrefix('bump', 'logo bumpin', 24); logoBl.animation.addByPrefix('bump', 'logo bumpin', 24);
logoBl.animation.play('bump'); logoBl.animation.play('bump');
logoBl.updateHitbox(); logoBl.updateHitbox();
logoBl.shader = swagShader.shader; logoBl.shader = swagShader.shader;
@ -271,6 +269,9 @@ class TitleState extends MusicBeatState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
if (FlxG.keys.justPressed.EIGHT)
FlxG.switchState(new CutsceneAnimTestState());
/* /*
if (FlxG.keys.justPressed.R) if (FlxG.keys.justPressed.R)
{ {