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

First prototype of can logic

This commit is contained in:
Eric Myllyoja 2022-07-14 19:03:42 -04:00
parent ee3e1750df
commit 4172fd861d
9 changed files with 121 additions and 60 deletions

View file

@ -1,17 +1,35 @@
{ {
"dependencies": [ "dependencies": [
{ {
"name": "discord_rpc", "name": "hxcpp",
"type": "git", "type": "haxelib",
"dir": null, "version": "4.2.1"
"ref": "2d83fa8", },
"url": "https://github.com/Aidan63/linc_discord-rpc" {
"name": "hxcpp-debug-server",
"type": "haxelib",
"version": "1.2.4"
},
{
"name": "thx.semver",
"type": "haxelib",
"version": "0.2.2"
},
{
"name": "lime",
"type": "haxelib",
"version": "7.9.0"
},
{
"name": "openfl",
"type": "haxelib",
"version": "9.1.0"
}, },
{ {
"name": "flixel", "name": "flixel",
"type": "git", "type": "git",
"dir": null, "dir": null,
"ref": "0637ac4", "ref": "75a2789",
"url": "https://github.com/haxeflixel/flixel" "url": "https://github.com/haxeflixel/flixel"
}, },
{ {
@ -25,38 +43,16 @@
"version": "2.4.0" "version": "2.4.0"
}, },
{ {
"name": "flxanimate", "name": "discord_rpc",
"type": "git", "type": "git",
"dir": null, "dir": null,
"ref": "master", "ref": "2d83fa8",
"url": "https://github.com/Dot-Stuff/flxanimate" "url": "https://github.com/Aidan63/linc_discord-rpc"
}, },
{ {
"name": "hscript", "name": "hscript",
"type": "git",
"dir": null,
"ref": "7124b6c",
"url": "https://github.com/HaxeFoundation/hscript"
},
{
"name": "hxcpp",
"type": "haxelib", "type": "haxelib",
"version": "4.2.1" "version": "2.5.0"
},
{
"name": "hxcpp-debug-server",
"type": "haxelib",
"version": "1.2.4"
},
{
"name": "lime",
"type": "haxelib",
"version": "7.9.0"
},
{
"name": "openfl",
"type": "haxelib",
"version": "9.1.0"
}, },
{ {
"name": "polymod", "name": "polymod",
@ -66,9 +62,11 @@
"url": "https://github.com/larsiusprime/polymod" "url": "https://github.com/larsiusprime/polymod"
}, },
{ {
"name": "thx.semver", "name": "flxanimate",
"type": "haxelib", "type": "git",
"version": "0.2.2" "dir": null,
"ref": "90c44ca",
"url": "https://github.com/Dot-Stuff/flxanimate"
} }
] ]
} }

View file

@ -74,20 +74,28 @@ class Main extends Sprite
var stageWidth:Int = Lib.current.stage.stageWidth; var stageWidth:Int = Lib.current.stage.stageWidth;
var stageHeight:Int = Lib.current.stage.stageHeight; var stageHeight:Int = Lib.current.stage.stageHeight;
if (zoom == -1) // if (zoom == -1)
{ // {
var ratioX:Float = stageWidth / gameWidth; // var ratioX:Float = stageWidth / gameWidth;
var ratioY:Float = stageHeight / gameHeight; // var ratioY:Float = stageHeight / gameHeight;
zoom = Math.min(ratioX, ratioY); // zoom = Math.min(ratioX, ratioY);
gameWidth = Math.ceil(stageWidth / zoom); // gameWidth = Math.ceil(stageWidth / zoom);
gameHeight = Math.ceil(stageHeight / zoom); // gameHeight = Math.ceil(stageHeight / zoom);
} // }
/**
* The `zoom` argument of FlxGame was removed in the dev branch of Flixel,
* since it was considered confusing and unintuitive.
* If you want to change how the game scales when you resize the window,
* you can use `FlxG.scaleMode`.
* -Eric
*/
#if !debug #if !debug
initialState = TitleState; initialState = TitleState;
#end #end
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen)); addChild(new FlxGame(gameWidth, gameHeight, initialState, framerate, framerate, skipSplash, startFullscreen));
#if debug #if debug
fpsCounter = new FPS(10, 3, 0xFFFFFF); fpsCounter = new FPS(10, 3, 0xFFFFFF);

View file

@ -80,7 +80,7 @@ class FreeplayState extends MusicBeatSubstate
#if debug #if debug
isDebug = true; isDebug = true;
addSong('Test', 1, 'bf-pixel'); addSong('Test', 1, 'bf-pixel');
addSong('Pyro', 4, 'bf'); addSong('Pyro', 8, 'darnell');
#end #end
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
@ -127,7 +127,6 @@ class FreeplayState extends MusicBeatSubstate
trace(FlxG.camera.zoom); trace(FlxG.camera.zoom);
trace(FlxG.camera.initialZoom); trace(FlxG.camera.initialZoom);
trace(FlxCamera.defaultZoom); trace(FlxCamera.defaultZoom);
trace(FlxG.initialZoom);
var pinkBack:FlxSprite = new FlxSprite().loadGraphic(Paths.image('freeplay/pinkBack')); var pinkBack:FlxSprite = new FlxSprite().loadGraphic(Paths.image('freeplay/pinkBack'));
pinkBack.color = 0xFFffd4e9; // sets it to pink! pinkBack.color = 0xFFffd4e9; // sets it to pink!

View file

@ -61,6 +61,7 @@ class GameOverSubstate extends MusicBeatSubstate
Conductor.songPosition = 0; Conductor.songPosition = 0;
// TODO: Make SFX and music easily overriden by scripts.
playBlueBalledSFX(); playBlueBalledSFX();
switch (PlayState.instance.currentStageId) switch (PlayState.instance.currentStageId)
@ -68,7 +69,7 @@ class GameOverSubstate extends MusicBeatSubstate
case 'school' | 'schoolEvil': case 'school' | 'schoolEvil':
musicVariant = "-pixel"; musicVariant = "-pixel";
default: default:
if (PlayState.instance.currentStage.getBoyfriend().characterId == 'pico') if (['pico', 'pico-playable'].contains(PlayState.instance.currentStage.getBoyfriend().characterId))
{ {
musicVariant = "Pico"; musicVariant = "Pico";
} }
@ -89,7 +90,7 @@ class GameOverSubstate extends MusicBeatSubstate
boyfriend.isDead = true; boyfriend.isDead = true;
add(boyfriend); add(boyfriend);
boyfriend.resetCharacter(); boyfriend.resetCharacter();
boyfriend.playAnimation('firstDeath'); boyfriend.playAnimation('firstDeath', true, true);
cameraFollowPoint = new FlxObject(PlayState.instance.cameraFollowPoint.x, PlayState.instance.cameraFollowPoint.y, 1, 1); cameraFollowPoint = new FlxObject(PlayState.instance.cameraFollowPoint.x, PlayState.instance.cameraFollowPoint.y, 1, 1);
cameraFollowPoint.x = boyfriend.getGraphicMidpoint().x; cameraFollowPoint.x = boyfriend.getGraphicMidpoint().x;

View file

@ -54,23 +54,72 @@ interface INoteScriptedClass extends IScriptedClass
*/ */
interface IPlayStateScriptedClass extends IScriptedClass interface IPlayStateScriptedClass extends IScriptedClass
{ {
/**
* Called when the game is paused.
* Has properties to set whether the pause easter egg will happen,
* and can be cancelled by scripts.
*/
public function onPause(event:PauseScriptEvent):Void; public function onPause(event:PauseScriptEvent):Void;
/**
* Called when the game is unpaused.
*/
public function onResume(event:ScriptEvent):Void; public function onResume(event:ScriptEvent):Void;
public function onSongLoaded(eent:SongLoadScriptEvent):Void; /**
* Called when the song has been parsed, before notes have been placed.
* Use this to mutate the chart.
*/
public function onSongLoaded(event:SongLoadScriptEvent):Void;
/**
* Called when the song starts (conductor time is 0 seconds).
*/
public function onSongStart(event:ScriptEvent):Void; public function onSongStart(event:ScriptEvent):Void;
/**
* Called when the song ends and the song is about to be unloaded.
*/
public function onSongEnd(event:ScriptEvent):Void; public function onSongEnd(event:ScriptEvent):Void;
/**
* Called as the player runs out of health just before the game over substate is entered.
*/
public function onGameOver(event:ScriptEvent):Void; public function onGameOver(event:ScriptEvent):Void;
/**
* Called when the player restarts the song, either via pause menu or restarting after a game over.
*/
public function onSongRetry(event:ScriptEvent):Void; public function onSongRetry(event:ScriptEvent):Void;
/**
* Called when EITHER player hits a note.
* Query the note attached to the event to determine if it was hit by the player or CPU.
*/
public function onNoteHit(event:NoteScriptEvent):Void; public function onNoteHit(event:NoteScriptEvent):Void;
/**
* Called when EITHER player (usually the player) misses a note.
*/
public function onNoteMiss(event:NoteScriptEvent):Void; public function onNoteMiss(event:NoteScriptEvent):Void;
/**
* Called when the player presses a key when no note is on the strumline.
*/
public function onNoteGhostMiss(event:GhostMissNoteScriptEvent):Void; public function onNoteGhostMiss(event:GhostMissNoteScriptEvent):Void;
/**
* Called once every step of the song.
*/
public function onStepHit(event:SongTimeScriptEvent):Void; public function onStepHit(event:SongTimeScriptEvent):Void;
/**
* Called once every beat of the song.
*/
public function onBeatHit(event:SongTimeScriptEvent):Void; public function onBeatHit(event:SongTimeScriptEvent):Void;
/**
* Called when the countdown of the song starts.
*/
public function onCountdownStart(event:CountdownScriptEvent):Void; public function onCountdownStart(event:CountdownScriptEvent):Void;
/**
* Called when the a part of the countdown happens.
*/
public function onCountdownStep(event:CountdownScriptEvent):Void; public function onCountdownStep(event:CountdownScriptEvent):Void;
/**
* Called when the countdown of the song ends.
*/
public function onCountdownEnd(event:CountdownScriptEvent):Void; public function onCountdownEnd(event:CountdownScriptEvent):Void;
} }

View file

@ -779,6 +779,8 @@ class PlayState extends MusicBeatState implements IHook
function startSong():Void function startSong():Void
{ {
dispatchEvent(new ScriptEvent(ScriptEvent.SONG_START));
startingSong = false; startingSong = false;
previousFrameTime = FlxG.game.ticks; previousFrameTime = FlxG.game.ticks;
@ -1387,6 +1389,8 @@ class PlayState extends MusicBeatState implements IHook
function endSong():Void function endSong():Void
{ {
dispatchEvent(new ScriptEvent(ScriptEvent.SONG_END));
seenCutscene = false; seenCutscene = false;
deathCounter = 0; deathCounter = 0;
mayPauseGame = false; mayPauseGame = false;
@ -1844,13 +1848,15 @@ class PlayState extends MusicBeatState implements IHook
// bruh this var is bonkers i thot it was a function lmfaooo // bruh this var is bonkers i thot it was a function lmfaooo
// Break up into individual lines to aid debugging.
var shouldShowComboText:Bool = (curBeat % 8 == 7);
var daSection = SongLoad.getSong()[Std.int(curStep / 16)];
shouldShowComboText = shouldShowComboText && (daSection != null && daSection.mustHitSection);
shouldShowComboText = shouldShowComboText && (combo > 5);
var shouldShowComboText:Bool = (curBeat % 8 == 7) // End of measure. TODO: Is this always the correct time? var daNextSection = SongLoad.getSong()[Std.int(curStep / 16) + 1];
&& (SongLoad.getSong()[Std.int(curStep / 16)].mustHitSection) // Current section is BF's. var isEndOfSong = SongLoad.getSong().length < Std.int(curStep / 16);
&& (combo > 5) // Don't want to show on small combos. shouldShowComboText = shouldShowComboText && (isEndOfSong || (daNextSection != null && !daNextSection.mustHitSection));
&& ((SongLoad.getSong().length < Std.int(curStep / 16)) // Show at the end of the song.
|| (!SongLoad.getSong()[Std.int(curStep / 16) + 1].mustHitSection) // Or when the next section is Dad's.
);
if (shouldShowComboText) if (shouldShowComboText)
{ {

View file

@ -249,9 +249,9 @@ class BaseCharacter extends Bopper
// so we can query which ones are available. // so we can query which ones are available.
this.comboNoteCounts = findCountAnimations('combo'); // example: combo50 this.comboNoteCounts = findCountAnimations('combo'); // example: combo50
this.dropNoteCounts = findCountAnimations('drop'); // example: drop50 this.dropNoteCounts = findCountAnimations('drop'); // example: drop50
trace('${this.animation.getNameList()}'); // trace('${this.animation.getNameList()}');
trace('Combo note counts: ' + this.comboNoteCounts); // trace('Combo note counts: ' + this.comboNoteCounts);
trace('Drop note counts: ' + this.dropNoteCounts); // trace('Drop note counts: ' + this.dropNoteCounts);
super.onCreate(event); super.onCreate(event);
} }

View file

@ -360,7 +360,7 @@ class Bopper extends FlxSprite implements IPlayStateScriptedClass
public function onCountdownEnd(event:CountdownScriptEvent) {} public function onCountdownEnd(event:CountdownScriptEvent) {}
public function onSongLoaded(eent:SongLoadScriptEvent) {} public function onSongLoaded(event:SongLoadScriptEvent) {}
public function onSongRetry(event:ScriptEvent) {} public function onSongRetry(event:ScriptEvent) {}
} }

View file

@ -561,7 +561,7 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
public function onNoteGhostMiss(event:GhostMissNoteScriptEvent) {} public function onNoteGhostMiss(event:GhostMissNoteScriptEvent) {}
public function onSongLoaded(eent:SongLoadScriptEvent) {} public function onSongLoaded(event:SongLoadScriptEvent) {}
public function onSongRetry(event:ScriptEvent) {} public function onSongRetry(event:ScriptEvent) {}
} }