mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-26 15:07:14 +00:00
Ported all base game characters
This commit is contained in:
parent
a7d338becb
commit
386e8db830
|
@ -1,43 +0,0 @@
|
|||
package funkin;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.util.FlxTimer;
|
||||
|
||||
using StringTools;
|
||||
|
||||
class Boyfriend extends Character
|
||||
{
|
||||
// public var stunned:Bool = false;
|
||||
public function new(x:Float, y:Float, ?char:String = 'bf')
|
||||
{
|
||||
super(x, y, char, true);
|
||||
}
|
||||
|
||||
public var startedDeath:Bool = false;
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (!debugMode)
|
||||
{
|
||||
if (animation.curAnim.name.startsWith('sing'))
|
||||
{
|
||||
holdTimer += elapsed;
|
||||
}
|
||||
else
|
||||
holdTimer = 0;
|
||||
|
||||
if (animation.curAnim.name.endsWith('miss') && animation.curAnim.finished && !debugMode)
|
||||
{
|
||||
playAnim('idle', true, false, 10);
|
||||
}
|
||||
|
||||
if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished && startedDeath)
|
||||
{
|
||||
playAnim('deathLoop');
|
||||
}
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
}
|
|
@ -1,722 +0,0 @@
|
|||
package funkin;
|
||||
|
||||
import funkin.util.Constants;
|
||||
import funkin.Note.NoteData;
|
||||
import funkin.SongLoad.SwagSong;
|
||||
import funkin.Section.SwagSection;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.animation.FlxBaseAnimation;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.util.FlxSort;
|
||||
import haxe.io.Path;
|
||||
import funkin.play.PlayState;
|
||||
|
||||
using StringTools;
|
||||
|
||||
class Character extends FlxSprite
|
||||
{
|
||||
public var animOffsets:Map<String, Array<Dynamic>>;
|
||||
public var debugMode:Bool = false;
|
||||
|
||||
public var isPlayer:Bool = false;
|
||||
public var curCharacter:String = 'bf';
|
||||
|
||||
public var holdTimer:Float = 0;
|
||||
|
||||
public var animationNotes:Array<NoteData> = [];
|
||||
|
||||
public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
animOffsets = new Map<String, Array<Dynamic>>();
|
||||
curCharacter = character;
|
||||
this.isPlayer = isPlayer;
|
||||
|
||||
var tex:FlxAtlasFrames;
|
||||
antialiasing = true;
|
||||
|
||||
switch (curCharacter)
|
||||
{
|
||||
case 'gf':
|
||||
// GIRLFRIEND CODE
|
||||
tex = Paths.getSparrowAtlas('characters/GF_assets');
|
||||
frames = tex;
|
||||
quickAnimAdd('cheer', 'GF Cheer');
|
||||
quickAnimAdd('singLEFT', 'GF left note');
|
||||
quickAnimAdd('singRIGHT', 'GF Right Note');
|
||||
quickAnimAdd('singUP', 'GF Up Note');
|
||||
quickAnimAdd('singDOWN', 'GF Down Note');
|
||||
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, true);
|
||||
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
||||
animation.addByIndices('hairBlow', "GF Dancing Beat Hair blowing", [0, 1, 2, 3], "", 24);
|
||||
animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false);
|
||||
animation.addByPrefix('scared', 'GF FEAR', 24, true);
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('danceRight');
|
||||
case 'gf-christmas':
|
||||
tex = Paths.getSparrowAtlas('characters/gfChristmas');
|
||||
frames = tex;
|
||||
quickAnimAdd('cheer', 'GF Cheer');
|
||||
quickAnimAdd('singLEFT', 'GF left note');
|
||||
quickAnimAdd('singRIGHT', 'GF Right Note');
|
||||
quickAnimAdd('singUP', 'GF Up Note');
|
||||
quickAnimAdd('singDOWN', 'GF Down Note');
|
||||
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, false);
|
||||
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
||||
animation.addByIndices('hairBlow', "GF Dancing Beat Hair blowing", [0, 1, 2, 3], "", 24);
|
||||
animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false);
|
||||
animation.addByPrefix('scared', 'GF FEAR', 24, true);
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('danceRight');
|
||||
case 'gf-tankmen':
|
||||
frames = Paths.getSparrowAtlas('characters/gfTankmen');
|
||||
animation.addByIndices('sad', 'GF Crying at Gunpoint', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, true);
|
||||
animation.addByIndices('danceLeft', 'GF Dancing at Gunpoint', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
animation.addByIndices('danceRight', 'GF Dancing at Gunpoint', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
||||
|
||||
loadOffsetFile('gf');
|
||||
playAnim('danceRight');
|
||||
|
||||
case 'bf-holding-gf':
|
||||
frames = Paths.getSparrowAtlas('characters/bfAndGF');
|
||||
quickAnimAdd('idle', 'BF idle dance');
|
||||
quickAnimAdd('singDOWN', 'BF NOTE DOWN0');
|
||||
quickAnimAdd('singLEFT', 'BF NOTE LEFT0');
|
||||
quickAnimAdd('singRIGHT', 'BF NOTE RIGHT0');
|
||||
quickAnimAdd('singUP', 'BF NOTE UP0');
|
||||
|
||||
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS');
|
||||
quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS');
|
||||
quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS');
|
||||
quickAnimAdd('singUPmiss', 'BF NOTE UP MISS');
|
||||
quickAnimAdd('bfCatch', 'BF catches GF');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
flipX = true;
|
||||
|
||||
case 'gf-car':
|
||||
tex = Paths.getSparrowAtlas('characters/gfCar');
|
||||
frames = tex;
|
||||
animation.addByIndices('singUP', 'GF Dancing Beat Hair blowing CAR', [0], "", 24, false);
|
||||
animation.addByIndices('danceLeft', 'GF Dancing Beat Hair blowing CAR', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
animation.addByIndices('danceRight', 'GF Dancing Beat Hair blowing CAR', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24,
|
||||
false);
|
||||
animation.addByIndices('idleHair', 'GF Dancing Beat Hair blowing CAR', [10, 11, 12, 25, 26, 27], "", 24, true);
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('danceRight');
|
||||
|
||||
case 'gf-pixel':
|
||||
tex = Paths.getSparrowAtlas('characters/gfPixel');
|
||||
frames = tex;
|
||||
animation.addByIndices('singUP', 'GF IDLE', [2], "", 24, false);
|
||||
animation.addByIndices('danceLeft', 'GF IDLE', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
animation.addByIndices('danceRight', 'GF IDLE', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('danceRight');
|
||||
|
||||
setGraphicSize(Std.int(width * Constants.PIXEL_ART_SCALE));
|
||||
updateHitbox();
|
||||
antialiasing = false;
|
||||
|
||||
case 'spooky':
|
||||
tex = Paths.getSparrowAtlas('characters/spooky_kids_assets');
|
||||
frames = tex;
|
||||
quickAnimAdd('singUP', 'spooky UP NOTE');
|
||||
quickAnimAdd('singDOWN', 'spooky DOWN note');
|
||||
quickAnimAdd('singLEFT', 'note sing left');
|
||||
quickAnimAdd('singRIGHT', 'spooky sing right');
|
||||
animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], "", 12, false);
|
||||
animation.addByIndices('danceRight', 'spooky dance idle', [8, 10, 12, 14], "", 12, false);
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('danceRight');
|
||||
case 'mom':
|
||||
tex = Paths.getSparrowAtlas('characters/Mom_Assets');
|
||||
frames = tex;
|
||||
|
||||
quickAnimAdd('idle', "Mom Idle");
|
||||
quickAnimAdd('singUP', "Mom Up Pose");
|
||||
quickAnimAdd('singDOWN', "MOM DOWN POSE");
|
||||
quickAnimAdd('singLEFT', 'Mom Left Pose');
|
||||
// ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT
|
||||
// CUZ DAVE IS DUMB!
|
||||
quickAnimAdd('singRIGHT', 'Mom Pose Left');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
case 'mom-car':
|
||||
tex = Paths.getSparrowAtlas('characters/momCar');
|
||||
frames = tex;
|
||||
|
||||
quickAnimAdd('idle', "Mom Idle");
|
||||
quickAnimAdd('singUP', "Mom Up Pose");
|
||||
quickAnimAdd('singDOWN', "MOM DOWN POSE");
|
||||
quickAnimAdd('singLEFT', 'Mom Left Pose');
|
||||
// ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT
|
||||
// CUZ DAVE IS DUMB!
|
||||
quickAnimAdd('singRIGHT', 'Mom Pose Left');
|
||||
animation.addByIndices('idleHair', "Mom Idle", [10, 11, 12, 13], "", 24, true);
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
case 'monster':
|
||||
tex = Paths.getSparrowAtlas('characters/Monster_Assets');
|
||||
frames = tex;
|
||||
quickAnimAdd('idle', 'monster idle');
|
||||
quickAnimAdd('singUP', 'monster up note');
|
||||
quickAnimAdd('singDOWN', 'monster down');
|
||||
quickAnimAdd('singLEFT', 'Monster left note');
|
||||
quickAnimAdd('singRIGHT', 'Monster Right note');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
case 'monster-christmas':
|
||||
tex = Paths.getSparrowAtlas('characters/monsterChristmas');
|
||||
frames = tex;
|
||||
quickAnimAdd('idle', 'monster idle');
|
||||
quickAnimAdd('singUP', 'monster up note');
|
||||
quickAnimAdd('singDOWN', 'monster down');
|
||||
quickAnimAdd('singLEFT', 'Monster left note');
|
||||
quickAnimAdd('singRIGHT', 'Monster Right note');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
case 'pico':
|
||||
tex = Paths.getSparrowAtlas('characters/Pico_FNF_assetss');
|
||||
frames = tex;
|
||||
quickAnimAdd('idle', "Pico Idle Dance");
|
||||
quickAnimAdd('singUP', 'pico Up note0');
|
||||
quickAnimAdd('singDOWN', 'Pico Down Note0');
|
||||
|
||||
// isPlayer = true;
|
||||
|
||||
// Need to be flipped! REDO THIS LATER!
|
||||
quickAnimAdd('singLEFT', 'Pico Note Right0');
|
||||
quickAnimAdd('singRIGHT', 'Pico NOTE LEFT0');
|
||||
quickAnimAdd('singRIGHTmiss', 'Pico NOTE LEFT miss');
|
||||
quickAnimAdd('singLEFTmiss', 'Pico Note Right Miss');
|
||||
|
||||
quickAnimAdd('singUPmiss', 'pico Up note miss');
|
||||
quickAnimAdd('singDOWNmiss', 'Pico Down Note MISS');
|
||||
|
||||
// right now it loads a seperate offset file for pico, would be cool if could generalize it!
|
||||
var playerShit:String = "";
|
||||
|
||||
if (isPlayer)
|
||||
playerShit += "Player";
|
||||
|
||||
loadOffsetFile(curCharacter + playerShit);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
flipX = true;
|
||||
|
||||
case 'pico-speaker':
|
||||
frames = Paths.getSparrowAtlas('characters/picoSpeaker');
|
||||
|
||||
quickAnimAdd('shoot1', "Pico shoot 1");
|
||||
quickAnimAdd('shoot2', "Pico shoot 2");
|
||||
quickAnimAdd('shoot3', "Pico shoot 3");
|
||||
quickAnimAdd('shoot4', "Pico shoot 4");
|
||||
|
||||
// here for now, will be replaced later for less copypaste
|
||||
loadOffsetFile(curCharacter);
|
||||
playAnim('shoot1');
|
||||
|
||||
loadMappedAnims();
|
||||
|
||||
case 'bf-christmas':
|
||||
var tex = Paths.getSparrowAtlas('characters/bfChristmas');
|
||||
frames = tex;
|
||||
quickAnimAdd('idle', 'BF idle dance');
|
||||
quickAnimAdd('singUP', 'BF NOTE UP0');
|
||||
quickAnimAdd('singLEFT', 'BF NOTE LEFT0');
|
||||
quickAnimAdd('singRIGHT', 'BF NOTE RIGHT0');
|
||||
quickAnimAdd('singDOWN', 'BF NOTE DOWN0');
|
||||
quickAnimAdd('singUPmiss', 'BF NOTE UP MISS');
|
||||
quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS');
|
||||
quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS');
|
||||
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS');
|
||||
quickAnimAdd('hey', 'BF HEY');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
flipX = true;
|
||||
case 'bf-car':
|
||||
var tex = Paths.getSparrowAtlas('characters/bfCar');
|
||||
frames = tex;
|
||||
quickAnimAdd('idle', 'BF idle dance');
|
||||
quickAnimAdd('singUP', 'BF NOTE UP0');
|
||||
quickAnimAdd('singLEFT', 'BF NOTE LEFT0');
|
||||
quickAnimAdd('singRIGHT', 'BF NOTE RIGHT0');
|
||||
quickAnimAdd('singDOWN', 'BF NOTE DOWN0');
|
||||
quickAnimAdd('singUPmiss', 'BF NOTE UP MISS');
|
||||
quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS');
|
||||
quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS');
|
||||
quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS');
|
||||
animation.addByIndices('idleHair', 'BF idle dance', [10, 11, 12, 13], "", 24, true);
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
flipX = true;
|
||||
case 'bf-pixel':
|
||||
frames = Paths.getSparrowAtlas('characters/bfPixel');
|
||||
quickAnimAdd('idle', 'BF IDLE');
|
||||
quickAnimAdd('singUP', 'BF UP NOTE');
|
||||
quickAnimAdd('singLEFT', 'BF LEFT NOTE');
|
||||
quickAnimAdd('singRIGHT', 'BF RIGHT NOTE');
|
||||
quickAnimAdd('singDOWN', 'BF DOWN NOTE');
|
||||
quickAnimAdd('singUPmiss', 'BF UP MISS');
|
||||
quickAnimAdd('singLEFTmiss', 'BF LEFT MISS');
|
||||
quickAnimAdd('singRIGHTmiss', 'BF RIGHT MISS');
|
||||
quickAnimAdd('singDOWNmiss', 'BF DOWN MISS');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
setGraphicSize(Std.int(width * 6));
|
||||
updateHitbox();
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
width -= 100;
|
||||
height -= 100;
|
||||
|
||||
antialiasing = false;
|
||||
|
||||
flipX = true;
|
||||
case 'bf-pixel-dead':
|
||||
frames = Paths.getSparrowAtlas('characters/bfPixelsDEAD');
|
||||
quickAnimAdd('singUP', "BF Dies pixel");
|
||||
quickAnimAdd('firstDeath', "BF Dies pixel");
|
||||
animation.addByPrefix('deathLoop', "Retry Loop", 24, true);
|
||||
quickAnimAdd('deathConfirm', "RETRY CONFIRM");
|
||||
animation.play('firstDeath');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('firstDeath');
|
||||
// pixel bullshit
|
||||
setGraphicSize(Std.int(width * 6));
|
||||
updateHitbox();
|
||||
antialiasing = false;
|
||||
flipX = true;
|
||||
|
||||
case 'bf-holding-gf-dead':
|
||||
frames = Paths.getSparrowAtlas('characters/bfHoldingGF-DEAD');
|
||||
quickAnimAdd('singUP', 'BF Dead with GF Loop');
|
||||
quickAnimAdd('firstDeath', 'BF Dies with GF');
|
||||
animation.addByPrefix('deathLoop', 'BF Dead with GF Loop', 24, true);
|
||||
quickAnimAdd('deathConfirm', 'RETRY confirm holding gf');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('firstDeath');
|
||||
|
||||
flipX = true;
|
||||
|
||||
case 'senpai':
|
||||
frames = Paths.getSparrowAtlas('characters/senpai');
|
||||
quickAnimAdd('idle', 'Senpai Idle');
|
||||
// at framerate 16.8 animation plays over 2 beats at 144bpm,
|
||||
// but if the game lags or the bpm is > 144 (mods etc.)
|
||||
// he may miss his next dance
|
||||
// animation.getByName('idle').frameRate = 16.8;
|
||||
|
||||
quickAnimAdd('singUP', 'SENPAI UP NOTE');
|
||||
quickAnimAdd('singLEFT', 'SENPAI LEFT NOTE');
|
||||
quickAnimAdd('singRIGHT', 'SENPAI RIGHT NOTE');
|
||||
quickAnimAdd('singDOWN', 'SENPAI DOWN NOTE');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
setGraphicSize(Std.int(width * 6));
|
||||
updateHitbox();
|
||||
|
||||
antialiasing = false;
|
||||
case 'senpai-angry':
|
||||
frames = Paths.getSparrowAtlas('characters/senpai');
|
||||
quickAnimAdd('idle', 'Angry Senpai Idle');
|
||||
quickAnimAdd('singUP', 'Angry Senpai UP NOTE');
|
||||
quickAnimAdd('singLEFT', 'Angry Senpai LEFT NOTE');
|
||||
quickAnimAdd('singRIGHT', 'Angry Senpai RIGHT NOTE');
|
||||
quickAnimAdd('singDOWN', 'Angry Senpai DOWN NOTE');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
setGraphicSize(Std.int(width * 6));
|
||||
updateHitbox();
|
||||
|
||||
antialiasing = false;
|
||||
|
||||
case 'spirit':
|
||||
frames = Paths.getPackerAtlas('characters/spirit');
|
||||
quickAnimAdd('idle', "idle spirit_");
|
||||
quickAnimAdd('singUP', "up_");
|
||||
quickAnimAdd('singRIGHT', "right_");
|
||||
quickAnimAdd('singLEFT', "left_");
|
||||
quickAnimAdd('singDOWN', "spirit down_");
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
setGraphicSize(Std.int(width * 6));
|
||||
updateHitbox();
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
antialiasing = false;
|
||||
|
||||
case 'parents-christmas':
|
||||
frames = Paths.getSparrowAtlas('characters/mom_dad_christmas_assets');
|
||||
quickAnimAdd('idle', 'Parent Christmas Idle');
|
||||
quickAnimAdd('singUP', 'Parent Up Note Dad');
|
||||
quickAnimAdd('singDOWN', 'Parent Down Note Dad');
|
||||
quickAnimAdd('singLEFT', 'Parent Left Note Dad');
|
||||
quickAnimAdd('singRIGHT', 'Parent Right Note Dad');
|
||||
|
||||
quickAnimAdd('singUP-alt', 'Parent Up Note Mom');
|
||||
|
||||
quickAnimAdd('singDOWN-alt', 'Parent Down Note Mom');
|
||||
quickAnimAdd('singLEFT-alt', 'Parent Left Note Mom');
|
||||
quickAnimAdd('singRIGHT-alt', 'Parent Right Note Mom');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
case 'tankman':
|
||||
frames = Paths.getSparrowAtlas('characters/tankmanCaptain');
|
||||
|
||||
quickAnimAdd('idle', "Tankman Idle Dance");
|
||||
|
||||
if (isPlayer)
|
||||
{
|
||||
quickAnimAdd('singLEFT', 'Tankman Note Left ');
|
||||
quickAnimAdd('singRIGHT', 'Tankman Right Note ');
|
||||
quickAnimAdd('singLEFTmiss', 'Tankman Note Left MISS');
|
||||
quickAnimAdd('singRIGHTmiss', 'Tankman Right Note MISS');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Need to be flipped! REDO THIS LATER
|
||||
quickAnimAdd('singLEFT', 'Tankman Right Note ');
|
||||
quickAnimAdd('singRIGHT', 'Tankman Note Left ');
|
||||
quickAnimAdd('singLEFTmiss', 'Tankman Right Note MISS');
|
||||
quickAnimAdd('singRIGHTmiss', 'Tankman Note Left MISS');
|
||||
}
|
||||
|
||||
quickAnimAdd('singUP', 'Tankman UP note ');
|
||||
quickAnimAdd('singDOWN', 'Tankman DOWN note ');
|
||||
quickAnimAdd('singUPmiss', 'Tankman UP note MISS');
|
||||
quickAnimAdd('singDOWNmiss', 'Tankman DOWN note MISS');
|
||||
|
||||
// PRETTY GOOD tankman
|
||||
// TANKMAN UGH instanc
|
||||
|
||||
quickAnimAdd('singDOWN-alt', 'PRETTY GOOD');
|
||||
quickAnimAdd('singUP-alt', 'TANKMAN UGH');
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
flipX = true;
|
||||
case 'darnell':
|
||||
frames = Paths.getSparrowAtlas('characters/darnell');
|
||||
|
||||
quickAnimAdd('idle', 'Darnell Idle');
|
||||
quickAnimAdd('singUP', "Darnell pose up");
|
||||
quickAnimAdd('singDOWN', 'Darnell Pose Down');
|
||||
quickAnimAdd('singRIGHT', 'darnell pose left');
|
||||
quickAnimAdd('singLEFT', 'Darnell pose right'); // naming is reversed for left/right for darnell!
|
||||
quickAnimAdd('laugh', 'darnell laugh');
|
||||
|
||||
// temp
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('idle');
|
||||
|
||||
animation.finishCallback = function(animShit:String)
|
||||
{
|
||||
if (animShit.startsWith('sing'))
|
||||
{
|
||||
// loop the anim
|
||||
// this way is a little verbose, but basically sets it to the same animation, but 8 frames before finish
|
||||
playAnim(animShit, true, false, animation.getByName(animShit).frames.length - 8);
|
||||
}
|
||||
}
|
||||
case 'darnell-fighter':
|
||||
frames = Paths.getSparrowAtlas('fightDarnell');
|
||||
|
||||
quickAnimAdd('idle', "fight idle darnell");
|
||||
quickAnimAdd('block', 'block');
|
||||
quickAnimAdd('hit high', 'hit high');
|
||||
quickAnimAdd('hit low', 'hit low');
|
||||
quickAnimAdd('punch low', 'punch low');
|
||||
quickAnimAdd('punch high', 'punch high');
|
||||
quickAnimAdd('dodge', 'dodge');
|
||||
playAnim('idle');
|
||||
|
||||
addOffset('punch low', -90);
|
||||
addOffset('punch high', -90);
|
||||
addOffset('block', 50, 20);
|
||||
addOffset('dodge', 50, -20);
|
||||
|
||||
case 'pico-fighter':
|
||||
frames = Paths.getSparrowAtlas('fightPico');
|
||||
|
||||
quickAnimAdd('idle', 'fight idle pico');
|
||||
quickAnimAdd('block', 'block');
|
||||
quickAnimAdd('hit high', 'hit high');
|
||||
quickAnimAdd('hit low', 'hit low');
|
||||
quickAnimAdd('punch low', 'punch low');
|
||||
quickAnimAdd('punch high', 'punch high');
|
||||
quickAnimAdd('dodge', 'dodge');
|
||||
playAnim('idle');
|
||||
|
||||
addOffset('punch low', 160);
|
||||
addOffset('punch high', 160);
|
||||
|
||||
case 'nene':
|
||||
// GIRLFRIEND CODE
|
||||
tex = Paths.getSparrowAtlas('characters/Nene_assets');
|
||||
frames = tex;
|
||||
|
||||
animation.addByIndices('danceLeft', 'nenebeforeyougetawoopin', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
animation.addByIndices('danceRight', 'nenebeforeyougetawoopin', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
||||
|
||||
loadOffsetFile(curCharacter);
|
||||
|
||||
playAnim('danceRight');
|
||||
}
|
||||
|
||||
dance();
|
||||
animation.finish();
|
||||
|
||||
if (isPlayer)
|
||||
{
|
||||
flipX = !flipX;
|
||||
|
||||
// Doesn't flip for BF, since his are already in the right place???
|
||||
if (!curCharacter.startsWith('bf'))
|
||||
{
|
||||
// var animArray
|
||||
var oldRight = animation.getByName('singRIGHT').frames;
|
||||
animation.getByName('singRIGHT').frames = animation.getByName('singLEFT').frames;
|
||||
animation.getByName('singLEFT').frames = oldRight;
|
||||
|
||||
// IF THEY HAVE MISS ANIMATIONS??
|
||||
if (animation.getByName('singRIGHTmiss') != null)
|
||||
{
|
||||
var oldMiss = animation.getByName('singRIGHTmiss').frames;
|
||||
animation.getByName('singRIGHTmiss').frames = animation.getByName('singLEFTmiss').frames;
|
||||
animation.getByName('singLEFTmiss').frames = oldMiss;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function loadMappedAnims()
|
||||
{
|
||||
var swagshit:SwagSong = SongLoad.loadFromJson('stress', 'stress');
|
||||
|
||||
var notes:Array<SwagSection> = swagshit.noteMap.get('picospeaker');
|
||||
|
||||
for (section in notes)
|
||||
{
|
||||
for (noteData in section.sectionNotes)
|
||||
{
|
||||
animationNotes.push(noteData);
|
||||
}
|
||||
}
|
||||
|
||||
trace(animationNotes);
|
||||
animationNotes.sort(sortAnims);
|
||||
}
|
||||
|
||||
function sortAnims(val1:NoteData, val2:NoteData):Int
|
||||
{
|
||||
return FlxSort.byValues(FlxSort.ASCENDING, val1.strumTime, val2.strumTime);
|
||||
}
|
||||
|
||||
function quickAnimAdd(name:String, prefix:String)
|
||||
{
|
||||
animation.addByPrefix(name, prefix, 24, false);
|
||||
}
|
||||
|
||||
private function loadOffsetFile(offsetCharacter:String)
|
||||
{
|
||||
var daFile:Array<String> = CoolUtil.coolTextFile(Paths.file("images/characters/" + offsetCharacter + "Offsets.txt", TEXT, 'shared'));
|
||||
|
||||
for (i in daFile)
|
||||
{
|
||||
var splitWords:Array<String> = i.split(" ");
|
||||
addOffset(splitWords[0], Std.parseInt(splitWords[1]), Std.parseInt(splitWords[2]));
|
||||
}
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (!curCharacter.startsWith('bf'))
|
||||
{
|
||||
if (animation.curAnim.name.startsWith('sing'))
|
||||
{
|
||||
holdTimer += elapsed;
|
||||
}
|
||||
|
||||
var dadVar:Float = 4;
|
||||
|
||||
if (curCharacter == 'dad')
|
||||
dadVar = 6.1;
|
||||
if (holdTimer >= Conductor.stepCrochet * dadVar * 0.001)
|
||||
{
|
||||
dance();
|
||||
holdTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (curCharacter.endsWith('-car'))
|
||||
{
|
||||
// looping hair anims after idle finished
|
||||
if (!animation.curAnim.name.startsWith('sing') && animation.curAnim.finished)
|
||||
playAnim('idleHair');
|
||||
}
|
||||
|
||||
switch (curCharacter)
|
||||
{
|
||||
case 'gf':
|
||||
if (animation.curAnim.name == 'hairFall' && animation.curAnim.finished)
|
||||
playAnim('danceRight');
|
||||
case "pico-speaker":
|
||||
// for pico??
|
||||
if (animationNotes.length > 0)
|
||||
{
|
||||
if (Conductor.songPosition > animationNotes[0].strumTime)
|
||||
{
|
||||
trace('played shoot anim' + animationNotes[0].noteData);
|
||||
|
||||
var shootAnim:Int = 1;
|
||||
|
||||
if ((cast animationNotes[0].noteData) >= 2)
|
||||
shootAnim = 3;
|
||||
|
||||
shootAnim += FlxG.random.int(0, 1);
|
||||
|
||||
playAnim('shoot' + shootAnim, true);
|
||||
animationNotes.shift();
|
||||
}
|
||||
}
|
||||
|
||||
if (animation.curAnim.finished)
|
||||
{
|
||||
playAnim(animation.curAnim.name, false, false, animation.curAnim.numFrames - 3);
|
||||
}
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
private var danced:Bool = false;
|
||||
|
||||
/**
|
||||
* FOR GF DANCING SHIT
|
||||
*/
|
||||
public function dance()
|
||||
{
|
||||
if (animation == null || animation.curAnim == null)
|
||||
return;
|
||||
if (!debugMode)
|
||||
{
|
||||
switch (curCharacter)
|
||||
{
|
||||
case 'gf' | 'gf-christmas' | 'gf-car' | 'gf-pixel' | 'gf-tankmen' | "nene":
|
||||
if (!animation.curAnim.name.startsWith('hair'))
|
||||
{
|
||||
danced = !danced;
|
||||
|
||||
if (danced)
|
||||
playAnim('danceRight');
|
||||
else
|
||||
playAnim('danceLeft');
|
||||
}
|
||||
|
||||
case 'tankman':
|
||||
if (!animation.curAnim.name.endsWith('DOWN-alt'))
|
||||
playAnim('idle');
|
||||
|
||||
case 'spooky':
|
||||
danced = !danced;
|
||||
|
||||
if (danced)
|
||||
playAnim('danceRight');
|
||||
else
|
||||
playAnim('danceLeft');
|
||||
default:
|
||||
playAnim('idle');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
|
||||
{
|
||||
if (animation == null)
|
||||
return;
|
||||
animation.play(AnimName, Force, Reversed, Frame);
|
||||
|
||||
var daOffset = animOffsets.get(AnimName);
|
||||
if (animOffsets.exists(AnimName))
|
||||
{
|
||||
offset.set(daOffset[0], daOffset[1]);
|
||||
}
|
||||
else
|
||||
offset.set(0, 0);
|
||||
|
||||
if (curCharacter == 'gf')
|
||||
{
|
||||
if (AnimName == 'singLEFT')
|
||||
{
|
||||
danced = true;
|
||||
}
|
||||
else if (AnimName == 'singRIGHT')
|
||||
{
|
||||
danced = false;
|
||||
}
|
||||
|
||||
if (AnimName == 'singUP' || AnimName == 'singDOWN')
|
||||
{
|
||||
danced = !danced;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addOffset(name:String, x:Float = 0, y:Float = 0)
|
||||
{
|
||||
animOffsets[name] = [x, y];
|
||||
}
|
||||
}
|
|
@ -177,7 +177,7 @@ class InitState extends FlxTransitionableState
|
|||
#elseif FIGHT
|
||||
FlxG.switchState(new PicoFight());
|
||||
#elseif ANIMDEBUG
|
||||
FlxG.switchState(new ui.animDebugShit.DebugBoundingState());
|
||||
FlxG.switchState(new funkin.ui.animDebugShit.DebugBoundingState());
|
||||
#elseif NETTEST
|
||||
FlxG.switchState(new netTest.NetTest());
|
||||
#else
|
||||
|
|
|
@ -283,14 +283,14 @@ typedef RawNoteData =
|
|||
var strumTime:Float;
|
||||
var noteData:NoteType;
|
||||
var sustainLength:Float;
|
||||
var altNote:Bool;
|
||||
var altNote:String;
|
||||
var noteKind:NoteKind;
|
||||
}
|
||||
|
||||
@:forward
|
||||
abstract NoteData(RawNoteData)
|
||||
{
|
||||
public function new(strumTime = 0.0, noteData:NoteType = 0, sustainLength = 0.0, altNote = false, noteKind = NORMAL)
|
||||
public function new(strumTime = 0.0, noteData:NoteType = 0, sustainLength = 0.0, altNote = "", noteKind = NORMAL)
|
||||
{
|
||||
this = {
|
||||
strumTime: strumTime,
|
||||
|
|
|
@ -107,7 +107,7 @@ class Paths
|
|||
return 'assets/fonts/$key';
|
||||
}
|
||||
|
||||
inline static public function getSparrowAtlas(key:String, ?library:String)
|
||||
static public function getSparrowAtlas(key:String, ?library:String)
|
||||
{
|
||||
return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library));
|
||||
}
|
||||
|
|
|
@ -1012,7 +1012,7 @@ class ChartingState extends MusicBeatState
|
|||
if (curSelectedNote != null)
|
||||
{
|
||||
trace('ALT NOTE SHIT');
|
||||
curSelectedNote.altNote = !curSelectedNote.altNote;
|
||||
curSelectedNote.altNote = (curSelectedNote.altNote == "alt") ? "" : "alt";
|
||||
trace(curSelectedNote.altNote);
|
||||
}
|
||||
}
|
||||
|
@ -1348,7 +1348,7 @@ class ChartingState extends MusicBeatState
|
|||
var noteStrum = getStrumTime(dummyArrow.y) + sectionStartTime();
|
||||
var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE);
|
||||
var noteSus = 0;
|
||||
var noteAlt = false;
|
||||
var noteAlt = "";
|
||||
|
||||
justPlacedNote = true;
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ class DJBoyfriend extends FlxSprite
|
|||
addOffset('intro', 0, 0);
|
||||
addOffset('idle', -4, -426);
|
||||
|
||||
playAnim('intro');
|
||||
playAnimation('intro');
|
||||
animation.finishCallback = function(anim)
|
||||
{
|
||||
switch (anim)
|
||||
{
|
||||
case "intro":
|
||||
animHITsignal.dispatch();
|
||||
playAnim('idle'); // plays idle anim after playing intro
|
||||
playAnimation('idle'); // plays idle anim after playing intro
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class DJBoyfriend extends FlxSprite
|
|||
// playAnim stolen from Character.hx, cuz im lazy lol!
|
||||
public var animOffsets:Map<String, Array<Dynamic>>;
|
||||
|
||||
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
|
||||
public function playAnimation(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
|
||||
{
|
||||
animation.play(AnimName, Force, Reversed, Frame);
|
||||
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
package funkin.play;
|
||||
|
||||
import funkin.play.character.BaseCharacter;
|
||||
import flixel.FlxSprite;
|
||||
|
||||
class Fighter extends Character
|
||||
class Fighter extends BaseCharacter
|
||||
{
|
||||
public function new(?x:Float = 0, ?y:Float = 0, ?char:String = "pico-fighter")
|
||||
{
|
||||
super(x, y, char);
|
||||
super(char);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
animation.finishCallback = function(anim:String)
|
||||
{
|
||||
switch anim
|
||||
{
|
||||
case "punch low" | "punch high" | "block" | 'dodge':
|
||||
dance();
|
||||
dance(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -42,20 +45,20 @@ class Fighter extends Character
|
|||
|
||||
function dodge()
|
||||
{
|
||||
playAnim('dodge');
|
||||
playAnimation('dodge');
|
||||
curAction = DODGE;
|
||||
}
|
||||
|
||||
public function block()
|
||||
{
|
||||
playAnim('block');
|
||||
playAnimation('block');
|
||||
curAction = BLOCK;
|
||||
}
|
||||
|
||||
public function punch()
|
||||
{
|
||||
curAction = PUNCH;
|
||||
playAnim('punch ' + (FlxG.random.bool() ? "low" : "high"));
|
||||
playAnimation('punch ' + (FlxG.random.bool() ? "low" : "high"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ class PicoFight extends MusicBeatState
|
|||
pico.punch();
|
||||
}
|
||||
if (controls.NOTE_LEFT_R)
|
||||
pico.playAnim('idle');
|
||||
pico.playAnimation('idle');
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
|
|
@ -1471,7 +1471,7 @@ class PlayState extends MusicBeatState implements IHook
|
|||
private function popUpScore(strumtime:Float, daNote:Note):Void
|
||||
{
|
||||
var noteDiff:Float = Math.abs(strumtime - Conductor.songPosition);
|
||||
// boyfriend.playAnim('hey');
|
||||
// boyfriend.playAnimation('hey');
|
||||
vocals.volume = 1;
|
||||
|
||||
var score:Int = 350;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.play.character;
|
||||
|
||||
import flixel.math.FlxPoint;
|
||||
import funkin.modding.events.ScriptEvent;
|
||||
import funkin.modding.events.ScriptEvent.UpdateScriptEvent;
|
||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||
|
@ -25,8 +26,6 @@ class BaseCharacter extends Bopper
|
|||
*/
|
||||
public var characterType:CharacterType = OTHER;
|
||||
|
||||
final _data:CharacterData;
|
||||
|
||||
/**
|
||||
* Tracks how long, in seconds, the character has been playing the current `sing` animation.
|
||||
* This is used to ensure that characters play the `sing` animations for at least one beat,
|
||||
|
@ -34,9 +33,29 @@ class BaseCharacter extends Bopper
|
|||
*/
|
||||
public var holdTimer:Float = 0;
|
||||
|
||||
public var isDead:Bool = false;
|
||||
public var debugMode:Bool = false;
|
||||
|
||||
final _data:CharacterData;
|
||||
final singTimeCrochet:Float;
|
||||
|
||||
public var isDead:Bool = false;
|
||||
/**
|
||||
* The x and y position to subtract from the stage's X value to get the character's proper rendering position.
|
||||
*/
|
||||
public var characterOrigin(get, null):FlxPoint;
|
||||
|
||||
function get_characterOrigin():FlxPoint
|
||||
{
|
||||
var xPos = (width / 2); // Horizontal center
|
||||
var yPos = (height); // Vertical bottom
|
||||
trace('Origin: ${characterId} (${xPos}, ${yPos})');
|
||||
return new FlxPoint(xPos, yPos);
|
||||
}
|
||||
|
||||
override function set_x(value:Float):Float
|
||||
{
|
||||
return super.set_x(value);
|
||||
}
|
||||
|
||||
public function new(id:String)
|
||||
{
|
||||
|
@ -70,6 +89,17 @@ class BaseCharacter extends Bopper
|
|||
playDeathAnimation();
|
||||
}
|
||||
|
||||
if (hasAnimation('idle-end') && getCurrentAnimation() == "idle" && isAnimationFinished())
|
||||
playAnimation('idle-end');
|
||||
if (hasAnimation('singLEFT-end') && getCurrentAnimation() == "singLEFT" && isAnimationFinished())
|
||||
playAnimation('singLEFT-end');
|
||||
if (hasAnimation('singDOWN-end') && getCurrentAnimation() == "singDOWN" && isAnimationFinished())
|
||||
playAnimation('singDOWN-end');
|
||||
if (hasAnimation('singUP-end') && getCurrentAnimation() == "singUP" && isAnimationFinished())
|
||||
playAnimation('singUP-end');
|
||||
if (hasAnimation('singRIGHT-end') && getCurrentAnimation() == "singRIGHT" && isAnimationFinished())
|
||||
playAnimation('singRIGHT-end');
|
||||
|
||||
// Handle character note hold time.
|
||||
if (getCurrentAnimation().startsWith("sing"))
|
||||
{
|
||||
|
@ -109,6 +139,10 @@ class BaseCharacter extends Bopper
|
|||
|
||||
override function dance(force:Bool = false)
|
||||
{
|
||||
// Prevent default dancing behavior.
|
||||
if (debugMode)
|
||||
return;
|
||||
|
||||
if (!force)
|
||||
{
|
||||
if (getCurrentAnimation().startsWith("sing"))
|
||||
|
@ -202,12 +236,12 @@ class BaseCharacter extends Bopper
|
|||
if (event.note.mustPress && characterType == BF)
|
||||
{
|
||||
// If the note is from the same strumline, play the sing animation.
|
||||
this.playSingAnimation(event.note.data.dir, false, event.note.data.altNote ? "alt" : null);
|
||||
this.playSingAnimation(event.note.data.dir, false, event.note.data.altNote);
|
||||
}
|
||||
else if (!event.note.mustPress && characterType == DAD)
|
||||
{
|
||||
// If the note is from the same strumline, play the sing animation.
|
||||
this.playSingAnimation(event.note.data.dir, false, event.note.data.altNote ? "alt" : null);
|
||||
this.playSingAnimation(event.note.data.dir, false, event.note.data.altNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,12 +256,12 @@ class BaseCharacter extends Bopper
|
|||
if (event.note.mustPress && characterType == BF)
|
||||
{
|
||||
// If the note is from the same strumline, play the sing animation.
|
||||
this.playSingAnimation(event.note.data.dir, true, event.note.data.altNote ? "alt" : null);
|
||||
this.playSingAnimation(event.note.data.dir, true, event.note.data.altNote);
|
||||
}
|
||||
else if (!event.note.mustPress && characterType == DAD)
|
||||
{
|
||||
// If the note is from the same strumline, play the sing animation.
|
||||
this.playSingAnimation(event.note.data.dir, true, event.note.data.altNote ? "alt" : null);
|
||||
this.playSingAnimation(event.note.data.dir, true, event.note.data.altNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@ class MultiSparrowCharacter extends BaseCharacter
|
|||
{
|
||||
var texture:FlxFramesCollection = Paths.getSparrowAtlas(asset, 'shared');
|
||||
// If we don't do this, the unused textures will be removed as soon as they're loaded.
|
||||
texture.parent.destroyOnNoUse = false;
|
||||
|
||||
if (texture == null)
|
||||
{
|
||||
|
@ -95,6 +94,7 @@ class MultiSparrowCharacter extends BaseCharacter
|
|||
else
|
||||
{
|
||||
trace('Adding multi-sparrow atlas: ${asset}');
|
||||
texture.parent.destroyOnNoUse = false;
|
||||
members.set(asset, texture);
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ class MultiSparrowCharacter extends BaseCharacter
|
|||
trace('Using frames: ${anim.name}');
|
||||
loadFramesByAnimName(anim.name);
|
||||
trace('Adding animation');
|
||||
FlxAnimationUtil.addSparrowAnimation(this, anim);
|
||||
FlxAnimationUtil.addAtlasAnimation(this, anim);
|
||||
|
||||
if (anim.offsets == null)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package funkin.play.character;
|
||||
|
||||
import funkin.modding.events.ScriptEvent;
|
||||
import flixel.graphics.frames.FlxFramesCollection;
|
||||
import funkin.util.assets.FlxAnimationUtil;
|
||||
import funkin.play.character.BaseCharacter.CharacterType;
|
||||
|
||||
/**
|
||||
|
@ -12,5 +15,65 @@ class PackerCharacter extends BaseCharacter
|
|||
{
|
||||
super(id);
|
||||
}
|
||||
// TODO: Put code here, dumbass!
|
||||
|
||||
override function onCreate(event:ScriptEvent):Void
|
||||
{
|
||||
trace('Creating PACKER CHARACTER: ' + this.characterId);
|
||||
|
||||
loadSpritesheet();
|
||||
loadAnimations();
|
||||
|
||||
playAnimation(_data.startingAnimation);
|
||||
}
|
||||
|
||||
function loadSpritesheet()
|
||||
{
|
||||
trace('[PACKERCHAR] Loading spritesheet ${_data.assetPath} for ${characterId}');
|
||||
|
||||
var tex:FlxFramesCollection = Paths.getPackerAtlas(_data.assetPath, 'shared');
|
||||
if (tex == null)
|
||||
{
|
||||
trace('Could not load Packer sprite: ${_data.assetPath}');
|
||||
return;
|
||||
}
|
||||
|
||||
this.frames = tex;
|
||||
|
||||
if (_data.isPixel)
|
||||
{
|
||||
this.antialiasing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.antialiasing = true;
|
||||
}
|
||||
|
||||
if (_data.scale != null)
|
||||
{
|
||||
this.setGraphicSize(Std.int(this.width * this.scale.x));
|
||||
this.updateHitbox();
|
||||
}
|
||||
}
|
||||
|
||||
function loadAnimations()
|
||||
{
|
||||
trace('[PACKERCHAR] Loading ${_data.animations.length} animations for ${characterId}');
|
||||
|
||||
FlxAnimationUtil.addAtlasAnimations(this, _data.animations);
|
||||
|
||||
for (anim in _data.animations)
|
||||
{
|
||||
if (anim.offsets == null)
|
||||
{
|
||||
setAnimationOffsets(anim.name, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAnimationOffsets(anim.name, anim.offsets[0], anim.offsets[1]);
|
||||
}
|
||||
}
|
||||
|
||||
var animNames = this.animation.getNameList();
|
||||
trace('[PACKERCHAR] Successfully loaded ${animNames.length} animations for ${characterId}');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class SparrowCharacter extends BaseCharacter
|
|||
{
|
||||
trace('[SPARROWCHAR] Loading ${_data.animations.length} animations for ${characterId}');
|
||||
|
||||
FlxAnimationUtil.addSparrowAnimations(this, _data.animations);
|
||||
FlxAnimationUtil.addAtlasAnimations(this, _data.animations);
|
||||
|
||||
for (anim in _data.animations)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
|
|||
/**
|
||||
* Offset the character's sprite by this much when playing each animation.
|
||||
*/
|
||||
var animationOffsets:Map<String, Array<Int>> = new Map<String, Array<Int>>();
|
||||
public var animationOffsets:Map<String, Array<Int>> = new Map<String, Array<Int>>();
|
||||
|
||||
/**
|
||||
* Add a suffix to the `idle` animation (or `danceLeft` and `danceRight` animations)
|
||||
|
|
|
@ -32,7 +32,6 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
|
|||
|
||||
var namedProps:Map<String, FlxSprite> = new Map<String, FlxSprite>();
|
||||
var characters:Map<String, BaseCharacter> = new Map<String, BaseCharacter>();
|
||||
var charactersOld:Map<String, Character> = new Map<String, Character>();
|
||||
var boppers:Array<Bopper> = new Array<Bopper>();
|
||||
|
||||
/**
|
||||
|
@ -153,7 +152,7 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
|
|||
}
|
||||
}
|
||||
default: // "sparrow"
|
||||
FlxAnimationUtil.addSparrowAnimations(propSprite, dataProp.animations);
|
||||
FlxAnimationUtil.addAtlasAnimations(propSprite, dataProp.animations);
|
||||
}
|
||||
|
||||
if (Std.isOfType(propSprite, Bopper))
|
||||
|
@ -243,28 +242,49 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
|
|||
if (character == null)
|
||||
return;
|
||||
|
||||
var debugMarker:FlxSprite = new FlxSprite(0, 0);
|
||||
|
||||
// Apply position and z-index.
|
||||
switch (charType)
|
||||
{
|
||||
case BF:
|
||||
this.characters.set("bf", character);
|
||||
character.zIndex = _data.characters.bf.zIndex;
|
||||
character.x = _data.characters.bf.position[0];
|
||||
character.y = _data.characters.bf.position[1];
|
||||
// Subtracting the origin ensures characters are positioned relative to their feet.
|
||||
trace('Data: ' + _data.characters.bf.position[0] + ', ' + _data.characters.bf.position[1]);
|
||||
character.x = _data.characters.bf.position[0] - character.characterOrigin.x;
|
||||
character.y = _data.characters.bf.position[1] - character.characterOrigin.y;
|
||||
trace('Character position: ' + character.x + ', ' + character.y);
|
||||
debugMarker.x = _data.characters.bf.position[0];
|
||||
debugMarker.y = _data.characters.bf.position[1];
|
||||
trace('Debug marker position: ' + debugMarker.x + ', ' + debugMarker.y);
|
||||
case GF:
|
||||
this.characters.set("gf", character);
|
||||
character.zIndex = _data.characters.gf.zIndex;
|
||||
character.x = _data.characters.gf.position[0];
|
||||
character.y = _data.characters.gf.position[1];
|
||||
// Subtracting the origin ensures characters are positioned relative to their feet.
|
||||
character.x = _data.characters.gf.position[0] - character.characterOrigin.x;
|
||||
character.y = _data.characters.gf.position[1] - character.characterOrigin.y;
|
||||
debugMarker.x = _data.characters.gf.position[0];
|
||||
debugMarker.y = _data.characters.gf.position[1];
|
||||
case DAD:
|
||||
this.characters.set("dad", character);
|
||||
character.zIndex = _data.characters.dad.zIndex;
|
||||
character.x = _data.characters.dad.position[0];
|
||||
character.y = _data.characters.dad.position[1];
|
||||
// Subtracting the origin ensures characters are positioned relative to their feet.
|
||||
character.x = _data.characters.dad.position[0] - character.characterOrigin.x;
|
||||
character.y = _data.characters.dad.position[1] - character.characterOrigin.y;
|
||||
debugMarker.x = _data.characters.dad.position[0];
|
||||
debugMarker.y = _data.characters.dad.position[1];
|
||||
default:
|
||||
this.characters.set(character.characterId, character);
|
||||
}
|
||||
|
||||
#if debug
|
||||
// Add a DEBUG marker for the character's origin.
|
||||
debugMarker.makeGraphic(10, 10, 0xFFFF00FF);
|
||||
debugMarker.zIndex = 10000;
|
||||
this.add(debugMarker);
|
||||
#end
|
||||
|
||||
// Add the character to the scene.
|
||||
this.add(character);
|
||||
}
|
||||
|
@ -312,20 +332,16 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
|
|||
{
|
||||
return getCharacter('bf');
|
||||
}
|
||||
|
||||
// return this.charactersOld.get('bf');
|
||||
}
|
||||
|
||||
public function getGirlfriend():BaseCharacter
|
||||
{
|
||||
return getCharacter('gf');
|
||||
// return this.charactersOld.get('gf');
|
||||
}
|
||||
|
||||
public function getDad():BaseCharacter
|
||||
{
|
||||
return getCharacter('dad');
|
||||
// return this.charactersOld.get('dad');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,28 +4,79 @@ import flixel.system.FlxAssets.FlxShader;
|
|||
|
||||
class BuildingShaders
|
||||
{
|
||||
public var shader(default, null):BuildingShader;
|
||||
public var daAlpha:Float = 1;
|
||||
public var shader(default, null):BuildingShaderLegacy;
|
||||
|
||||
public function new():Void
|
||||
{
|
||||
shader = new BuildingShader();
|
||||
shader.alphaShit.value = [0];
|
||||
shader = new BuildingShaderLegacy();
|
||||
shader.buildingAlpha = 0;
|
||||
}
|
||||
|
||||
public function update(elapsed:Float):Void
|
||||
{
|
||||
shader.alphaShit.value[0] += elapsed;
|
||||
shader.buildingAlpha += elapsed;
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
shader.alphaShit.value[0] = 0;
|
||||
shader.buildingAlpha = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class BuildingShader extends FlxShader
|
||||
class BuildingShader extends FlxRuntimeShader
|
||||
{
|
||||
public var buildingAlpha(get, set):Float;
|
||||
|
||||
function get_buildingAlpha():Float
|
||||
{
|
||||
return getFloat('alphaShit');
|
||||
}
|
||||
|
||||
function set_buildingAlpha(value:Float):Float
|
||||
{
|
||||
// Every time buildingAlpha is changed, update the property of the shader.
|
||||
setFloat('alphaShit', value);
|
||||
return value;
|
||||
}
|
||||
|
||||
static final FRAGMENT_SHADER = "
|
||||
#pragma header
|
||||
|
||||
uniform float alphaShit;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv);
|
||||
|
||||
if (color.a > 0.0)
|
||||
color -= alphaShit;
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
";
|
||||
|
||||
public function new()
|
||||
{
|
||||
super(FRAGMENT_SHADER, null, true);
|
||||
}
|
||||
}
|
||||
|
||||
class BuildingShaderLegacy extends FlxShader
|
||||
{
|
||||
public var buildingAlpha(get, set):Float;
|
||||
|
||||
function get_buildingAlpha():Float
|
||||
{
|
||||
return alphaShit.value[0];
|
||||
}
|
||||
|
||||
function set_buildingAlpha(value:Float):Float
|
||||
{
|
||||
// Every time buildingAlpha is changed, update the property of the shader.
|
||||
alphaShit.value = [value];
|
||||
return value;
|
||||
}
|
||||
|
||||
@:glFragmentSource('
|
||||
#pragma header
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package funkin.ui.animDebugShit;
|
||||
|
||||
import flixel.FlxCamera;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
import flixel.addons.display.FlxGridOverlay;
|
||||
import flixel.addons.ui.FlxInputText;
|
||||
import flixel.addons.ui.FlxUIDropDownMenu;
|
||||
import flixel.FlxCamera;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.graphics.frames.FlxFrame;
|
||||
import flixel.group.FlxGroup;
|
||||
|
@ -15,6 +15,7 @@ import flixel.text.FlxText;
|
|||
import flixel.util.FlxColor;
|
||||
import flixel.util.FlxSpriteUtil;
|
||||
import flixel.util.FlxTimer;
|
||||
import funkin.play.character.BaseCharacter;
|
||||
import lime.utils.Assets as LimeAssets;
|
||||
import openfl.Assets;
|
||||
import openfl.events.Event;
|
||||
|
@ -249,7 +250,7 @@ class DebugBoundingState extends FlxState
|
|||
swagChar.offset.x = (FlxG.mouse.x - mouseOffset.x) * -1;
|
||||
swagChar.offset.y = (FlxG.mouse.y - mouseOffset.y) * -1;
|
||||
|
||||
swagChar.animOffsets.set(animDropDownMenu.selectedLabel, [swagChar.offset.x, swagChar.offset.y]);
|
||||
swagChar.animationOffsets.set(animDropDownMenu.selectedLabel, [Std.int(swagChar.offset.x), Std.int(swagChar.offset.y)]);
|
||||
|
||||
txtOffsetShit.text = 'Offset: ' + swagChar.offset;
|
||||
}
|
||||
|
@ -391,9 +392,9 @@ class DebugBoundingState extends FlxState
|
|||
if (FlxG.keys.justPressed.RIGHT || FlxG.keys.justPressed.LEFT || FlxG.keys.justPressed.UP || FlxG.keys.justPressed.DOWN)
|
||||
{
|
||||
var animName = animDropDownMenu.selectedLabel;
|
||||
var coolValues:Array<Dynamic> = swagChar.animOffsets.get(animName);
|
||||
var coolValues:Array<Int> = swagChar.animationOffsets.get(animName);
|
||||
|
||||
var multiplier:Float = 5;
|
||||
var multiplier:Int = 5;
|
||||
|
||||
if (FlxG.keys.pressed.CONTROL)
|
||||
multiplier = 1;
|
||||
|
@ -410,8 +411,8 @@ class DebugBoundingState extends FlxState
|
|||
else if (FlxG.keys.justPressed.DOWN)
|
||||
coolValues[1] -= 1 * multiplier;
|
||||
|
||||
swagChar.animOffsets.set(animDropDownMenu.selectedLabel, coolValues);
|
||||
swagChar.playAnim(animName);
|
||||
swagChar.animationOffsets.set(animDropDownMenu.selectedLabel, coolValues);
|
||||
swagChar.playAnimation(animName);
|
||||
|
||||
txtOffsetShit.text = 'Offset: ' + coolValues;
|
||||
|
||||
|
@ -422,9 +423,9 @@ class DebugBoundingState extends FlxState
|
|||
{
|
||||
var outputString:String = "";
|
||||
|
||||
for (i in swagChar.animOffsets.keys())
|
||||
for (i in swagChar.animationOffsets.keys())
|
||||
{
|
||||
outputString += i + " " + swagChar.animOffsets.get(i)[0] + " " + swagChar.animOffsets.get(i)[1] + "\n";
|
||||
outputString += i + " " + swagChar.animationOffsets.get(i)[0] + " " + swagChar.animationOffsets.get(i)[1] + "\n";
|
||||
}
|
||||
|
||||
outputString.trim();
|
||||
|
@ -432,7 +433,7 @@ class DebugBoundingState extends FlxState
|
|||
}
|
||||
}
|
||||
|
||||
var swagChar:Character;
|
||||
var swagChar:BaseCharacter;
|
||||
|
||||
function loadAnimShit(char:String)
|
||||
{
|
||||
|
@ -442,8 +443,10 @@ class DebugBoundingState extends FlxState
|
|||
swagChar.destroy();
|
||||
}
|
||||
|
||||
swagChar = new Character(100, 100, char);
|
||||
swagChar.debugMode = true;
|
||||
swagChar = new BaseCharacter(char);
|
||||
swagChar.x = 100;
|
||||
swagChar.y = 100;
|
||||
// swagChar.debugMode = true;
|
||||
offsetView.add(swagChar);
|
||||
|
||||
generateOutlines(swagChar.frames.frames);
|
||||
|
@ -451,11 +454,11 @@ class DebugBoundingState extends FlxState
|
|||
|
||||
var animThing:Array<String> = [];
|
||||
|
||||
for (i in swagChar.animOffsets.keys())
|
||||
for (i in swagChar.animationOffsets.keys())
|
||||
{
|
||||
animThing.push(i);
|
||||
trace(i);
|
||||
trace(swagChar.animOffsets[i]);
|
||||
trace(swagChar.animationOffsets[i]);
|
||||
}
|
||||
|
||||
animDropDownMenu.setData(FlxUIDropDownMenu.makeStrIdLabelArray(animThing, true));
|
||||
|
@ -468,8 +471,8 @@ class DebugBoundingState extends FlxState
|
|||
onionSkinChar.alpha = 0.6;
|
||||
|
||||
var animName = animThing[Std.parseInt(str)];
|
||||
swagChar.playAnim(animName, true); // trace();
|
||||
trace(swagChar.animOffsets.get(animName));
|
||||
swagChar.playAnimation(animName, true); // trace();
|
||||
trace(swagChar.animationOffsets.get(animName));
|
||||
|
||||
txtOffsetShit.text = 'Offset: ' + swagChar.offset;
|
||||
};
|
||||
|
@ -486,7 +489,7 @@ class DebugBoundingState extends FlxState
|
|||
_file.addEventListener(Event.COMPLETE, onSaveComplete);
|
||||
_file.addEventListener(Event.CANCEL, onSaveCancel);
|
||||
_file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError);
|
||||
_file.save(saveString, swagChar.curCharacter + "Offsets.txt");
|
||||
_file.save(saveString, swagChar.characterId + "Offsets.txt");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class FlxAnimationUtil
|
|||
/**
|
||||
* Properly adds an animation to a sprite based on JSON data.
|
||||
*/
|
||||
public static function addSparrowAnimation(target:FlxSprite, anim:AnimationData)
|
||||
public static function addAtlasAnimation(target:FlxSprite, anim:AnimationData)
|
||||
{
|
||||
var frameRate = anim.frameRate == null ? 24 : anim.frameRate;
|
||||
var looped = anim.looped == null ? false : anim.looped;
|
||||
|
@ -32,11 +32,11 @@ class FlxAnimationUtil
|
|||
/**
|
||||
* Properly adds multiple animations to a sprite based on JSON data.
|
||||
*/
|
||||
public static function addSparrowAnimations(target:FlxSprite, animations:Array<AnimationData>)
|
||||
public static function addAtlasAnimations(target:FlxSprite, animations:Array<AnimationData>)
|
||||
{
|
||||
for (anim in animations)
|
||||
{
|
||||
addSparrowAnimation(target, anim);
|
||||
addAtlasAnimation(target, anim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue