1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-09-11 20:57:20 +00:00

weekend fighting in progress + del superlinter

This commit is contained in:
Cameron Taylor 2022-02-18 16:29:29 -05:00
parent f5c3b7db02
commit f158a3929c
7 changed files with 286 additions and 20 deletions

View file

@ -1,10 +0,0 @@
jobs:
build:
runs-on: [ubuntu-latest, macos-latest]
steps:
- uses: krdlab/setup-haxe@v1
with:
haxe-version: 4.0.5
- run: |
haxe -version
haxelib install hxnodejs

View file

@ -509,6 +509,38 @@ class Character extends FlxSprite
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');

View file

@ -12,6 +12,7 @@ class MusicBeatState extends FlxUIState
private var curStep:Int = 0;
private var curBeat:Int = 0;
private var controls(get, never):Controls;
private var lastBeatHitTime:Float = 0;
inline function get_controls():Controls
return PlayerSettings.player1.controls;
@ -67,6 +68,7 @@ class MusicBeatState extends FlxUIState
public function beatHit():Void
{
lastBeatHitTime = Conductor.songPosition;
// do literally nothing dumbass
}
}

View file

@ -15,6 +15,7 @@ class PolygonSpectogram extends MeshRender
public var vis:VisShit;
public var visType:VISTYPE = UPDATED;
public var daHeight:Float = FlxG.height;
public var realtimeVisLenght:Float = 0.2;
var numSamples:Int = 0;
var setBuffer:Bool = false;
@ -22,6 +23,9 @@ class PolygonSpectogram extends MeshRender
public var audioData:Int16Array;
public var detail:Float = 1;
public var thickness:Float = 2;
public var waveAmplitude:Int = 100;
public function new(daSound:FlxSound, ?col:FlxColor = FlxColor.WHITE, ?height:Float = 720, ?detail:Float = 1)
{
super(0, 0, col);
@ -83,13 +87,15 @@ class PolygonSpectogram extends MeshRender
var sampleApprox:Int = Std.int(FlxMath.remapToRange(i, 0, funnyPixels, startSample, startSample + samplesToGen));
var curAud:CurAudioInfo = VisShit.getCurAud(audioData, sampleApprox);
var waveAmplitude:Int = 200;
var coolPoint:FlxPoint = new FlxPoint();
coolPoint.x = (curAud.balanced * waveAmplitude / 2 + waveAmplitude / 2);
coolPoint.x = (curAud.balanced * waveAmplitude);
coolPoint.y = (i / funnyPixels * daHeight);
add_quad(prevPoint.x, prevPoint.y, prevPoint.x + 2, prevPoint.y, coolPoint.x, coolPoint.y, coolPoint.x + 2, coolPoint.y + 2);
add_quad(prevPoint.x, prevPoint.y, prevPoint.x
+ thickness, prevPoint.y, coolPoint.x, coolPoint.y, coolPoint.x
+ thickness,
coolPoint.y
+ thickness);
prevPoint.x = coolPoint.x;
prevPoint.y = coolPoint.y;
@ -105,7 +111,7 @@ class PolygonSpectogram extends MeshRender
{
if (curTime != vis.snd.time)
{
trace("DOIN SHIT" + FlxG.random.int(0, 200));
// trace("DOIN SHIT" + FlxG.random.int(0, 200));
if (vis.snd.playing)
curTime = vis.snd.time;
@ -117,7 +123,7 @@ class PolygonSpectogram extends MeshRender
curTime = vis.snd.time;
generateSection(vis.snd.time, 0.2);
generateSection(vis.snd.time, realtimeVisLenght);
}
}
}

View file

@ -423,8 +423,9 @@ class ChartingState extends MusicBeatState
FlxG.sound.playMusic(Paths.inst(daSong), 0.6);
var musSpec:PolygonSpectogram = new PolygonSpectogram(FlxG.sound.music, FlxColor.RED, FlxG.height / 2, Math.floor(FlxG.height / 2));
musSpec.x += 70;
musSpec.x += 170;
musSpec.scrollFactor.set();
musSpec.waveAmplitude = 50;
// musSpec.visType = FREQUENCIES;
add(musSpec);

67
source/play/Fighter.hx Normal file
View file

@ -0,0 +1,67 @@
package play;
import flixel.FlxSprite;
class Fighter extends Character
{
public function new(?x:Float = 0, ?y:Float = 0, ?char:String = "pico-fighter")
{
super(x, y, char);
animation.finishCallback = function(anim:String)
{
switch anim
{
case "punch low" | "punch high" | "block" | 'dodge':
dance();
}
};
}
public var actions:Array<ACTIONS> = [PUNCH, BLOCK, DODGE];
public function doSomething(?forceAction:ACTIONS)
{
var daAction:ACTIONS = FlxG.random.getObject(actions);
if (forceAction != null)
daAction = forceAction;
switch (daAction)
{
case PUNCH:
punch();
case BLOCK:
block();
case DODGE:
dodge();
}
}
public var curAction:ACTIONS = DODGE;
function dodge()
{
playAnim('dodge');
curAction = DODGE;
}
public function block()
{
playAnim('block');
curAction = BLOCK;
}
public function punch()
{
curAction = PUNCH;
playAnim('punch ' + (FlxG.random.bool() ? "low" : "high"));
}
}
enum ACTIONS
{
DODGE;
BLOCK;
PUNCH;
}

View file

@ -1,36 +1,204 @@
package play;
import Note.NoteData;
import audiovis.PolygonSpectogram;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.addons.effects.FlxTrail;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxMath;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
class PicoFight extends MusicBeatState
{
var picoHealth:Float = 1;
var darnellHealth:Float = 1;
var pico:Fighter;
var darnell:Fighter;
var darnellGhost:Fighter;
var nextHitTmr:FlxSprite;
var funnyWave:PolygonSpectogram;
var noteQueue:Array<NoteData> = [];
var noteSpawner:FlxTypedGroup<FlxSprite>;
override function create()
{
Paths.setCurrentLevel("week8");
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height);
bg.scrollFactor.set();
add(bg);
// fuk u, hardcoded bullshit bitch
FlxG.sound.playMusic(Paths.inst("blazin"));
Conductor.bpm = 180;
SongLoad.loadFromJson('blazin', "blazin");
Conductor.changeBPM(SongLoad.songData.bpm);
for (dumbassSection in SongLoad.songData.noteMap['hard'])
{
for (noteStuf in dumbassSection.sectionNotes)
{
noteQueue.push(noteStuf);
trace(noteStuf);
}
}
funnyWave = new PolygonSpectogram(FlxG.sound.music, FlxColor.RED, FlxG.height);
funnyWave.x = (FlxG.width / 2);
funnyWave.realtimeVisLenght = 0.6;
add(funnyWave);
noteSpawner = new FlxTypedGroup<FlxSprite>();
add(noteSpawner);
makeNotes();
nextHitTmr = new FlxSprite((FlxG.width / 2) - 5).makeGraphic(10, FlxG.height, FlxColor.BLACK);
add(nextHitTmr);
var trailShit:FlxTrail = new FlxTrail(nextHitTmr);
add(trailShit);
pico = new Fighter(0, 300, "pico-fighter");
add(pico);
darnell = new Fighter(0, 300, "darnell-fighter");
add(darnell);
darnellGhost = new Fighter(0, 300, "darnell-fighter");
darnellGhost.alpha = 0.5;
add(darnellGhost);
mid = (FlxG.width / 2) - (pico.width / 2);
resetPositions();
// fuk u, hardcoded bullshit bitch
super.create();
}
function makeNotes()
{
for (notes in noteQueue)
{
if (notes.strumTime < Conductor.songPosition + (Conductor.crochet * 4))
{
spawnNote(notes);
spawnNote(notes, FlxObject.RIGHT);
}
}
}
function spawnNote(note:NoteData, facing:Int = FlxObject.LEFT)
{
var spr:FlxSprite = new FlxSprite(0, (FlxG.height / 2) - 60).makeGraphic(10, 120, Note.codeColors[note.noteData]);
spr.ID = Std.int(note.strumTime); // using ID as strum, lol!
spr.facing = facing;
noteSpawner.add(spr);
}
var mid:Float = (FlxG.width * 0.5) - 200;
function resetPositions()
{
resetPicoPos();
resetDarnell();
}
function resetPicoPos()
{
pico.x = mid + pico.width;
}
function resetDarnell()
{
darnell.x = mid - darnell.width;
}
var prevNoteHit:Float = 0;
override function update(elapsed:Float)
{
darnellGhost.x = darnell.x;
Conductor.songPosition = FlxG.sound.music.time;
funnyWave.thickness = CoolUtil.coolLerp(funnyWave.thickness, 2, 0.5);
funnyWave.waveAmplitude = Std.int(CoolUtil.coolLerp(funnyWave.waveAmplitude, 100, 0.1));
funnyWave.realtimeVisLenght = CoolUtil.coolLerp(funnyWave.realtimeVisLenght, 0.6, 0.1);
noteSpawner.forEachAlive((nt:FlxSprite) ->
{
// i forget how to make rhythm games
nt.x = (nt.ID - Conductor.songPosition) * (nt.ID / (Conductor.songPosition * 0.8));
if (nt.facing == FlxObject.RIGHT)
{
nt.x = FlxMath.remapToRange(nt.x, 0, FlxG.width, FlxG.width, 0);
nt.x -= FlxG.width / 2;
}
else
{
nt.x += FlxG.width / 2;
}
nt.scale.x = FlxMath.remapToRange(nt.ID - Conductor.songPosition, 0, Conductor.crochet * 3, 0.2, 2);
nt.scale.y = FlxMath.remapToRange((nt.ID - Conductor.songPosition), 0, Conductor.crochet * 2, 6, 0.2);
if (nt.ID < Conductor.songPosition)
nt.kill();
});
if (noteQueue.length > 0)
{
nextHitTmr.scale.y = FlxMath.remapToRange(Conductor.songPosition, prevNoteHit, noteQueue[0].strumTime, 1, 0);
darnellGhost.scale.x = darnellGhost.scale.y = FlxMath.remapToRange(Conductor.songPosition, prevNoteHit, noteQueue[0].strumTime, 2, 1);
darnellGhost.alpha = FlxMath.remapToRange(Conductor.songPosition, prevNoteHit, noteQueue[0].strumTime, 0.3, 0.1);
if (Conductor.songPosition >= noteQueue[0].strumTime)
{
prevNoteHit = noteQueue[0].strumTime;
noteQueue.shift();
darnell.doSomething(darnellGhost.curAction);
darnellGhost.doSomething();
darnellGhost.animation.curAnim.frameRate = 12;
}
}
if (controls.NOTE_LEFT_P)
{
pico.punch();
}
if (controls.NOTE_LEFT_R)
pico.playAnim('idle');
super.update(elapsed);
}
override function stepHit()
{
super.stepHit();
}
override function beatHit()
{
funnyWave.thickness = 10;
funnyWave.waveAmplitude = 300;
funnyWave.realtimeVisLenght = 0.1;
picoHealth += 1;
trace(picoHealth);
makeNotes();
// trace(picoHealth);
super.beatHit();
}
}