Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
dialogue
Browse files Browse the repository at this point in the history
  • Loading branch information
SpunBlue committed Jun 12, 2022
1 parent d9893c4 commit b94ae16
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project>
<!-- _________________________ Application Settings _________________________ -->

<app title="Friday Night Funkin' Sublime Engine" file="FNFSL" packageName="com.spunblue.fnfsl" package="com.spunblue.fnfsl" main="Main" company="spunblue" version="3.3.0" />
<app title="Friday Night Funkin' Sublime Engine" file="FNFSL" packageName="com.spunblue.fnfsl" package="com.spunblue.fnfsl" main="Main" company="spunblue" version="3.4.0" />

<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file
or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
Expand Down
3 changes: 3 additions & 0 deletions include/mods/data/test/dialogue.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:dad:Test 123
:bf:Test 123
:gf:Test 123
2 changes: 2 additions & 0 deletions include/mods/dialogue information.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
All dialogue text files must be named "dialogue.txt" and must be in the Song's folder. Also if you want to use your custom Portrait use ":player2:"! Only works on
modded songs though.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="portrait.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Portrait Enter instance 10000" x="0" y="0" width="1494" height="870"/>
<SubTexture name="Portrait Enter instance 10001" x="1554" y="0" width="1494" height="870"/>
<SubTexture name="Portrait Enter instance 10002" x="1554" y="0" width="1494" height="870"/>
<SubTexture name="Portrait Enter instance 10003" x="0" y="930" width="1494" height="870"/>
<SubTexture name="Portrait Enter instance 10004" x="0" y="930" width="1494" height="870"/>
<SubTexture name="Portrait Enter instance 10005" x="1554" y="930" width="1494" height="870"/>
<SubTexture name="Portrait Enter instance 10006" x="1554" y="930" width="1494" height="870"/>
<SubTexture name="Portrait Enter instance 10007" x="1554" y="930" width="1494" height="870"/>
<SubTexture name="Portrait Enter instance 10008" x="1554" y="930" width="1494" height="870"/>
</TextureAtlas>
File renamed without changes.
40 changes: 32 additions & 8 deletions source/DialogueBox.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package;

import sys.io.File;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.text.FlxTypeText;
Expand Down Expand Up @@ -289,6 +290,11 @@ class DialogueBox extends FlxSpriteGroup
}

super.update(elapsed);

if (portraitRight.visible && box.flipX) // no idea if this will work
box.flipX = false;
else if (!portraitRight.visible && !box.flipX)
box.flipX = true;
}

var isEnding:Bool = false;
Expand All @@ -308,14 +314,32 @@ class DialogueBox extends FlxSpriteGroup
switch (curCharacter)
{
case 'player2':
portraitRight.visible = false;
portraitLeft.visible = false;
if (!portraitLeft.visible)
{
//Use this for hardcoded only, Only works if sprite doesn't get changed by other character portraits. For example gf.
swagDialogue.color = FlxColor.BLACK;
portraitLeft.visible = true;
portraitLeft.animation.play('enter');
if (!PlayState.isMod){
portraitRight.visible = false;
portraitLeft.visible = false;
if (!portraitLeft.visible)
{
swagDialogue.color = FlxColor.BLACK;
portraitLeft.visible = true;
portraitLeft.animation.play('enter');
}
}
else{
portraitRight.visible = false;
portraitLeft.visible = false;
if (!portraitLeft.visible)
{
swagDialogue.color = FlxColor.BLACK;

portraitLeft.frames = FlxAtlasFrames.fromSparrow(openfl.display.BitmapData.fromFile("mods/images/characters/"
+ PlayState.SONG.player2 + "/portrait/portrait.png"), File.getContent("mods/images/characters/"
+ PlayState.SONG.player2 + "/portrait/portrait.xml"));
portraitLeft.animation.addByPrefix('enter', 'Portrait Enter', 24, false);
portraitLeft.screenCenter(X);

portraitLeft.visible = true;
portraitLeft.animation.play('enter');
}
}
case 'dad':
portraitRight.visible = false;
Expand Down
6 changes: 5 additions & 1 deletion source/ModsStoryMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ModsStoryMenu extends MusicBeatState{
add(difficultyText);

// high score text on the black bar top right
highScoreText = new FlxText(0, 0, FlxG.width, "High Score: 0");
highScoreText = new FlxText(0, 0, FlxG.width, "");
highScoreText.setFormat("PhantomMuff 1.5", Std.int(FlxG.height * 0.03), 0xffffffff, "right");
highScoreText.setPosition(FlxG.width - highScoreText.width, 32);
highScoreText.scrollFactor.x = 0;
Expand Down Expand Up @@ -142,6 +142,10 @@ class ModsStoryMenu extends MusicBeatState{
camFollow.y = optionGroup.members[curSelected].y - camFollow.height / 2;
}

if (highScoreText.text == "" && optionsArray.length > 0){
getHighscore();
}

if (controls.UP_P){
curSelected--;
if (curSelected < 0) {
Expand Down
18 changes: 17 additions & 1 deletion source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@ class PlayState extends MusicBeatState
dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue'));
case 'tutorial':
dialogue = [":gf:Holy shit you're hot as funk" , ':bf:Holy shit you\'re also hot as funk', ':gf:... Wanna Funk?'];
default:
if (isMod){
var daList:Array<String> = File.getContent('mods/data/' + SONG.song.toLowerCase() + '/dialogue.txt').trim().split('\n');

for (i in 0...daList.length)
{
daList[i] = daList[i].trim();
}

dialogue = daList;
trace("Dialogue: " + dialogue);
}
}

#if desktop
Expand Down Expand Up @@ -944,7 +956,11 @@ class PlayState extends MusicBeatState
case 'tutorial':
schoolIntro(doof);
default:
startCountdown();
if (!isMod)
startCountdown();
else if (isMod && dialogue != [] || isMod && dialogue != null){
schoolIntro(doof);
}
}
}
else
Expand Down

0 comments on commit b94ae16

Please sign in to comment.