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": [
{
"name": "discord_rpc",
"type": "git",
"dir": null,
"ref": "2d83fa8",
"url": "https://github.com/Aidan63/linc_discord-rpc"
"name": "hxcpp",
"type": "haxelib",
"version": "4.2.1"
},
{
"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",
"type": "git",
"dir": null,
"ref": "0637ac4",
"ref": "75a2789",
"url": "https://github.com/haxeflixel/flixel"
},
{
@ -25,38 +43,16 @@
"version": "2.4.0"
},
{
"name": "flxanimate",
"name": "discord_rpc",
"type": "git",
"dir": null,
"ref": "master",
"url": "https://github.com/Dot-Stuff/flxanimate"
"ref": "2d83fa8",
"url": "https://github.com/Aidan63/linc_discord-rpc"
},
{
"name": "hscript",
"type": "git",
"dir": null,
"ref": "7124b6c",
"url": "https://github.com/HaxeFoundation/hscript"
},
{
"name": "hxcpp",
"type": "haxelib",
"version": "4.2.1"
},
{
"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"
"version": "2.5.0"
},
{
"name": "polymod",
@ -66,9 +62,11 @@
"url": "https://github.com/larsiusprime/polymod"
},
{
"name": "thx.semver",
"type": "haxelib",
"version": "0.2.2"
"name": "flxanimate",
"type": "git",
"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 stageHeight:Int = Lib.current.stage.stageHeight;
if (zoom == -1)
{
var ratioX:Float = stageWidth / gameWidth;
var ratioY:Float = stageHeight / gameHeight;
zoom = Math.min(ratioX, ratioY);
gameWidth = Math.ceil(stageWidth / zoom);
gameHeight = Math.ceil(stageHeight / zoom);
}
// if (zoom == -1)
// {
// var ratioX:Float = stageWidth / gameWidth;
// var ratioY:Float = stageHeight / gameHeight;
// zoom = Math.min(ratioX, ratioY);
// gameWidth = Math.ceil(stageWidth / 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
initialState = TitleState;
#end
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));
addChild(new FlxGame(gameWidth, gameHeight, initialState, framerate, framerate, skipSplash, startFullscreen));
#if debug
fpsCounter = new FPS(10, 3, 0xFFFFFF);

View file

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

View file

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

View file

@ -54,23 +54,72 @@ interface INoteScriptedClass 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;
/**
* Called when the game is unpaused.
*/
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;
/**
* Called when the song ends and the song is about to be unloaded.
*/
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;
/**
* Called when the player restarts the song, either via pause menu or restarting after a game over.
*/
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;
/**
* Called when EITHER player (usually the player) misses a note.
*/
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;
/**
* Called once every step of the song.
*/
public function onStepHit(event:SongTimeScriptEvent):Void;
/**
* Called once every beat of the song.
*/
public function onBeatHit(event:SongTimeScriptEvent):Void;
/**
* Called when the countdown of the song starts.
*/
public function onCountdownStart(event:CountdownScriptEvent):Void;
/**
* Called when the a part of the countdown happens.
*/
public function onCountdownStep(event:CountdownScriptEvent):Void;
/**
* Called when the countdown of the song ends.
*/
public function onCountdownEnd(event:CountdownScriptEvent):Void;
}

View file

@ -779,6 +779,8 @@ class PlayState extends MusicBeatState implements IHook
function startSong():Void
{
dispatchEvent(new ScriptEvent(ScriptEvent.SONG_START));
startingSong = false;
previousFrameTime = FlxG.game.ticks;
@ -1387,6 +1389,8 @@ class PlayState extends MusicBeatState implements IHook
function endSong():Void
{
dispatchEvent(new ScriptEvent(ScriptEvent.SONG_END));
seenCutscene = false;
deathCounter = 0;
mayPauseGame = false;
@ -1844,13 +1848,15 @@ class PlayState extends MusicBeatState implements IHook
// 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?
&& (SongLoad.getSong()[Std.int(curStep / 16)].mustHitSection) // Current section is BF's.
&& (combo > 5) // Don't want to show on small combos.
&& ((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.
);
var daNextSection = SongLoad.getSong()[Std.int(curStep / 16) + 1];
var isEndOfSong = SongLoad.getSong().length < Std.int(curStep / 16);
shouldShowComboText = shouldShowComboText && (isEndOfSong || (daNextSection != null && !daNextSection.mustHitSection));
if (shouldShowComboText)
{

View file

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

View file

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