Merge branch 'main' of https://github.com/YoshiCrafter29/CodenameEngine
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
1856
|
||||
1859
|
||||
@@ -73,12 +73,12 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
|
||||
|
||||
}
|
||||
|
||||
public function playSingAnim(direction:Int, suffix:String = "", Reversed:Bool = false, Frame:Int = 0) {
|
||||
public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Reversed:Bool = false, Frame:Int = 0) {
|
||||
var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"];
|
||||
|
||||
var event = new DirectionAnimEvent('${anims[direction]}$suffix', direction, suffix, Reversed, Frame);
|
||||
var event = new DirectionAnimEvent('${anims[direction]}$suffix', direction, suffix, Context, Reversed, Frame);
|
||||
script.call("onPlaySingAnim", [event]);
|
||||
if (!event.cancelled) playAnim(event.animName, event.force, SING, event.reversed, event.frame);
|
||||
if (!event.cancelled) playAnim(event.animName, event.force, Context, event.reversed, event.frame);
|
||||
}
|
||||
|
||||
public function new(x:Float, y:Float, ?character:String = "bf", isPlayer:Bool = false, switchAnims:Bool = true)
|
||||
|
||||
@@ -1347,9 +1347,6 @@ class PlayState extends MusicBeatState
|
||||
if (storyPlaylist.length <= 0)
|
||||
{
|
||||
|
||||
transIn = FlxTransitionableState.defaultTransIn;
|
||||
transOut = FlxTransitionableState.defaultTransOut;
|
||||
|
||||
FlxG.switchState(new StoryMenuState());
|
||||
|
||||
if (SONG.validScore)
|
||||
@@ -1435,7 +1432,7 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
if (!boyfriend.stunned)
|
||||
{
|
||||
var event:NoteHitEvent = scripts.event("onPlayerMiss", new NoteHitEvent(note, boyfriend, true, note.noteType, note.strumID, -0.04, false, -10));
|
||||
var event:NoteHitEvent = scripts.event("onPlayerMiss", new NoteHitEvent(note, [boyfriend], true, note.noteType, note.strumID, -0.04, false, -10));
|
||||
|
||||
if (event.cancelled) return;
|
||||
|
||||
@@ -1452,19 +1449,15 @@ class PlayState extends MusicBeatState
|
||||
FlxG.sound.play(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2));
|
||||
|
||||
if (muteVocalsOnMiss) vocals.volume = 0;
|
||||
boyfriend.stunned = true;
|
||||
|
||||
switch (note.strumID)
|
||||
{
|
||||
case 0:
|
||||
boyfriend.playAnim('singLEFTmiss', true, MISS);
|
||||
case 1:
|
||||
boyfriend.playAnim('singDOWNmiss', true, MISS);
|
||||
case 2:
|
||||
boyfriend.playAnim('singUPmiss', true, MISS);
|
||||
case 3:
|
||||
boyfriend.playAnim('singRIGHTmiss', true, MISS);
|
||||
for(char in event.characters) {
|
||||
if (char == null) continue;
|
||||
|
||||
char.stunned = true;
|
||||
char.playSingAnim(note.strumID, "miss", MISS);
|
||||
}
|
||||
// boyfriend.stunned = true;
|
||||
|
||||
deleteNote(note);
|
||||
}
|
||||
}
|
||||
@@ -1508,9 +1501,9 @@ class PlayState extends MusicBeatState
|
||||
|
||||
var event:NoteHitEvent;
|
||||
if (note.mustPress)
|
||||
event = scripts.event("onPlayerHit", new NoteHitEvent(note, boyfriend, true, note.noteType, note.strumID, note.noteData > 0 ? 0.023 : 0.004, score, note.animSuffix, daRating, note.isSustainNote ? null : accuracy, "game/score/", ''));
|
||||
event = scripts.event("onPlayerHit", new NoteHitEvent(note, [boyfriend], true, note.noteType, note.strumID, note.noteData > 0 ? 0.023 : 0.004, score, note.animSuffix, daRating, note.isSustainNote ? null : accuracy, "game/score/", ''));
|
||||
else
|
||||
event = scripts.event("onDadHit", new NoteHitEvent(note, dad, false, note.noteType, note.strumID, 0, 0, note.animSuffix, daRating, null, "game/score/", ''));
|
||||
event = scripts.event("onDadHit", new NoteHitEvent(note, [dad], false, note.noteType, note.strumID, 0, 0, note.animSuffix, daRating, null, "game/score/", ''));
|
||||
|
||||
if (!event.cancelled) {
|
||||
if (event.accuracy != null) {
|
||||
@@ -1599,9 +1592,10 @@ class PlayState extends MusicBeatState
|
||||
|
||||
health += event.healthGain;
|
||||
|
||||
if (!event.animCancelled) {
|
||||
event.character.playSingAnim(event.direction, event.animSuffix);
|
||||
}
|
||||
if (!event.animCancelled)
|
||||
for(char in event.characters)
|
||||
if (char != null)
|
||||
char.playSingAnim(event.direction, event.animSuffix);
|
||||
|
||||
if (!event.strumGlowCancelled) (event.player ? playerStrums : cpuStrums).forEach(function(str:Strum) {
|
||||
if (str.ID == Math.abs(note.strumID)) {
|
||||
|
||||
@@ -17,8 +17,10 @@ import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.util.FlxColor;
|
||||
import lime.app.Application;
|
||||
import funkin.scripting.events.*;
|
||||
|
||||
import funkin.options.OptionsMenu;
|
||||
|
||||
@@ -39,6 +41,8 @@ class MainMenuState extends MusicBeatState
|
||||
var magenta:FlxSprite;
|
||||
var camFollow:FlxObject;
|
||||
|
||||
public var canAccessDebugMenus:Bool = true;
|
||||
|
||||
override function create()
|
||||
{
|
||||
super.create();
|
||||
@@ -48,46 +52,36 @@ class MainMenuState extends MusicBeatState
|
||||
DiscordClient.changePresence("In the Menus", null);
|
||||
#end
|
||||
|
||||
transIn = FlxTransitionableState.defaultTransIn;
|
||||
transOut = FlxTransitionableState.defaultTransOut;
|
||||
|
||||
CoolUtil.playMenuSong();
|
||||
|
||||
persistentUpdate = persistentDraw = true;
|
||||
|
||||
var bg:FlxSprite = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuBG'));
|
||||
bg.scrollFactor.x = 0;
|
||||
bg.scrollFactor.y = 0.18;
|
||||
bg.scale.set(1.15, 1.15);
|
||||
bg.updateHitbox();
|
||||
bg.screenCenter();
|
||||
bg.antialiasing = true;
|
||||
add(bg);
|
||||
|
||||
camFollow = new FlxObject(0, 0, 1, 1);
|
||||
add(camFollow);
|
||||
|
||||
magenta = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuDesat'));
|
||||
magenta.scrollFactor.x = 0;
|
||||
magenta.scrollFactor.y = 0.18;
|
||||
magenta.scale.set(1.15, 1.15);
|
||||
magenta.updateHitbox();
|
||||
magenta.screenCenter();
|
||||
magenta.visible = false;
|
||||
magenta.antialiasing = true;
|
||||
magenta.color = 0xFFfd719b;
|
||||
add(magenta);
|
||||
// magenta.scrollFactor.set();
|
||||
|
||||
for(bg in [bg, magenta]) {
|
||||
bg.scrollFactor.set(0, 0.18);
|
||||
bg.scale.set(1.15, 1.15);
|
||||
bg.updateHitbox();
|
||||
bg.screenCenter();
|
||||
bg.antialiasing = true;
|
||||
}
|
||||
|
||||
menuItems = new FlxTypedGroup<FlxSprite>();
|
||||
add(menuItems);
|
||||
|
||||
for (i in 0...optionShit.length)
|
||||
for (i=>option in optionShit)
|
||||
{
|
||||
var menuItem:FlxSprite = new FlxSprite(0, 60 + (i * 160));
|
||||
menuItem.frames = Paths.getFrames('menus/mainmenu/${optionShit[i]}');
|
||||
menuItem.animation.addByPrefix('idle', optionShit[i] + " basic", 24);
|
||||
menuItem.animation.addByPrefix('selected', optionShit[i] + " white", 24);
|
||||
menuItem.frames = Paths.getFrames('menus/mainmenu/${option}');
|
||||
menuItem.animation.addByPrefix('idle', option + " basic", 24);
|
||||
menuItem.animation.addByPrefix('selected', option + " white", 24);
|
||||
menuItem.animation.play('idle');
|
||||
menuItem.ID = i;
|
||||
menuItem.screenCenter(X);
|
||||
@@ -103,8 +97,6 @@ class MainMenuState extends MusicBeatState
|
||||
versionShit.y -= versionShit.height;
|
||||
add(versionShit);
|
||||
|
||||
// NG.core.calls.event.logEvent('swag').send();
|
||||
|
||||
changeItem();
|
||||
}
|
||||
|
||||
@@ -113,35 +105,26 @@ class MainMenuState extends MusicBeatState
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (FlxG.sound.music.volume < 0.8)
|
||||
{
|
||||
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
|
||||
}
|
||||
|
||||
if (!selectedSomethin)
|
||||
{
|
||||
if (FlxG.keys.justPressed.SEVEN) {
|
||||
FlxG.switchState(new funkin.desktop.DesktopMain());
|
||||
}
|
||||
if (FlxG.keys.justPressed.F1) {
|
||||
funkin.multitasking.MultiTaskingHandler.openWindow("FreeplayState", new FreeplayState());
|
||||
if (canAccessDebugMenus) {
|
||||
if (FlxG.keys.justPressed.SEVEN)
|
||||
FlxG.switchState(new funkin.desktop.DesktopMain());
|
||||
|
||||
if (FlxG.keys.justPressed.F1)
|
||||
funkin.multitasking.MultiTaskingHandler.openWindow("FreeplayState", new FreeplayState());
|
||||
}
|
||||
|
||||
if (controls.UP_P)
|
||||
{
|
||||
CoolUtil.playMenuSFX(0);
|
||||
changeItem(-1);
|
||||
}
|
||||
|
||||
if (controls.DOWN_P)
|
||||
{
|
||||
CoolUtil.playMenuSFX(0);
|
||||
changeItem(1);
|
||||
}
|
||||
|
||||
if (controls.BACK)
|
||||
{
|
||||
FlxG.switchState(new TitleState());
|
||||
}
|
||||
|
||||
#if MOD_SUPPORT
|
||||
// make it customisable
|
||||
@@ -182,41 +165,40 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
if (Options.flashingMenu) FlxFlicker.flicker(magenta, 1.1, 0.15, false);
|
||||
|
||||
menuItems.forEach(function(spr:FlxSprite)
|
||||
FlxFlicker.flicker(menuItems.members[curSelected], 1, Options.flashingMenu ? 0.06 : 0.15, false, false, function(flick:FlxFlicker)
|
||||
{
|
||||
if (spr.ID != curSelected) return;
|
||||
FlxFlicker.flicker(spr, 1, Options.flashingMenu ? 0.06 : 0.15, false, false, function(flick:FlxFlicker)
|
||||
var daChoice:String = optionShit[curSelected];
|
||||
|
||||
var event = event("onSelectItem", new NameEvent(daChoice));
|
||||
if (event.cancelled) return;
|
||||
switch (daChoice)
|
||||
{
|
||||
var daChoice:String = optionShit[curSelected];
|
||||
case 'story mode':
|
||||
FlxG.switchState(new StoryMenuState());
|
||||
trace("Story Menu Selected");
|
||||
|
||||
switch (daChoice)
|
||||
{
|
||||
case 'story mode':
|
||||
FlxG.switchState(new StoryMenuState());
|
||||
trace("Story Menu Selected");
|
||||
case 'freeplay':
|
||||
FlxG.switchState(new FreeplayState());
|
||||
case 'freeplay':
|
||||
FlxG.switchState(new FreeplayState());
|
||||
trace("Freeplay Menu Selected");
|
||||
|
||||
trace("Freeplay Menu Selected");
|
||||
case 'donate':
|
||||
FlxG.switchState(new CreditsMain());
|
||||
case 'donate':
|
||||
FlxG.switchState(new CreditsMain());
|
||||
trace("Credits Menu Selected");
|
||||
|
||||
trace("Donate Menu Selected");
|
||||
|
||||
case 'options':
|
||||
FlxG.switchState(new OptionsMenu(false));
|
||||
}
|
||||
});
|
||||
case 'options':
|
||||
FlxG.switchState(new OptionsMenu(false));
|
||||
}
|
||||
});
|
||||
}
|
||||
function changeItem(huh:Int = 0)
|
||||
{
|
||||
curSelected += huh;
|
||||
var event = event("onChangeItem", new MenuChangeEvent(curSelected, FlxMath.wrap(curSelected + huh, 0, menuItems.length-1), huh, huh != 0));
|
||||
if (event.cancelled) return;
|
||||
|
||||
if (curSelected >= menuItems.length)
|
||||
curSelected = 0;
|
||||
if (curSelected < 0)
|
||||
curSelected = menuItems.length - 1;
|
||||
curSelected = event.value;
|
||||
|
||||
if (event.playMenuSFX)
|
||||
CoolUtil.playMenuSFX(0);
|
||||
|
||||
menuItems.forEach(function(spr:FlxSprite)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package funkin.scripting.events;
|
||||
|
||||
import funkin.scripting.events.PlayAnimEvent.PlayAnimContext;
|
||||
|
||||
class DirectionAnimEvent extends CancellableEvent {
|
||||
/**
|
||||
Default animation that will be played
|
||||
@@ -17,6 +19,10 @@ class DirectionAnimEvent extends CancellableEvent {
|
||||
Whenever the animation will play reversed or not.
|
||||
**/
|
||||
public var reversed:Bool;
|
||||
/**
|
||||
Context of the animation. Is either equal to `SING` or `MISS`.
|
||||
**/
|
||||
public var context:PlayAnimContext;
|
||||
/**
|
||||
Whenever the animation will play reversed or not.
|
||||
**/
|
||||
@@ -26,11 +32,12 @@ class DirectionAnimEvent extends CancellableEvent {
|
||||
**/
|
||||
public var frame:Int;
|
||||
|
||||
public function new(animName:String, direction:Int, suffix:String = "", reversed:Bool = false, frame:Int = 0) {
|
||||
public function new(animName:String, direction:Int, suffix:String = "", context:PlayAnimContext = SING, reversed:Bool = false, frame:Int = 0) {
|
||||
super();
|
||||
this.animName = animName;
|
||||
this.direction = direction;
|
||||
this.suffix = suffix;
|
||||
this.context = context;
|
||||
this.reversed = reversed;
|
||||
this.force = true;
|
||||
this.frame = frame;
|
||||
|
||||
@@ -21,10 +21,11 @@ class MenuChangeEvent extends CancellableEvent {
|
||||
*/
|
||||
public var playMenuSFX:Bool = true;
|
||||
|
||||
public function new(oldValue:Int, value:Int, change:Int) {
|
||||
public function new(oldValue:Int, value:Int, change:Int, playMenuSFX:Bool = true) {
|
||||
super();
|
||||
this.value = value;
|
||||
this.oldValue = value;
|
||||
this.change = change;
|
||||
this.playMenuSFX = playMenuSFX;
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,13 @@ class NoteHitEvent extends CancellableEvent {
|
||||
*/
|
||||
public var note:Note;
|
||||
/**
|
||||
* Character that pressed the note
|
||||
* Character that pressed the note.
|
||||
*/
|
||||
public var character:Character;
|
||||
public var character(get, set):Character;
|
||||
/**
|
||||
* Characters that pressed the note.
|
||||
*/
|
||||
public var characters:Array<Character>;
|
||||
/**
|
||||
* Whenever the Character is a player
|
||||
*/
|
||||
@@ -91,14 +95,14 @@ class NoteHitEvent extends CancellableEvent {
|
||||
/**
|
||||
* Creates a new NoteHitEvent.
|
||||
*/
|
||||
public function new(note:Note, character:Character, player:Bool, noteType:String,
|
||||
public function new(note:Note, characters:Array<Character>, player:Bool, noteType:String,
|
||||
direction:Int, healthGain:Float, unmuteVocals:Bool = true, score:Int = 350,
|
||||
animSuffix:String = "", rating:String = "sick", ?accuracy:Null<Float>, ratingPrefix:String = "",
|
||||
ratingSuffix:String = "") {
|
||||
super();
|
||||
|
||||
this.note = note;
|
||||
this.character = character;
|
||||
this.characters = characters;
|
||||
this.player = player;
|
||||
this.noteType = noteType;
|
||||
this.direction = direction;
|
||||
@@ -176,4 +180,11 @@ class NoteHitEvent extends CancellableEvent {
|
||||
}
|
||||
@:dox(hide)
|
||||
public function cancelStrumGlow() {preventStrumGlow();}
|
||||
|
||||
private inline function get_character()
|
||||
return characters[0];
|
||||
private function set_character(char:Character) {
|
||||
characters = [char];
|
||||
return char;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user