Skip to content

Commit

Permalink
Finish Dialogue System
Browse files Browse the repository at this point in the history
  • Loading branch information
poec987 committed Jun 27, 2024
1 parent ffba7a4 commit 51f4888
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 9 deletions.
2 changes: 1 addition & 1 deletion assets/preload/data/cocoa/cocoa-hard.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/preload/data/cocoa/cocoaDialogue.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:dad:I miss my wife, but I LOVE Peako
:bf:kys
5 changes: 5 additions & 0 deletions assets/shared/images/dialogue/boxes/songDBDefine.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pico::week3
philly::week3
blammed::week3
cocoa::week5
eggnog::week5
Binary file added assets/shared/images/dialogue/boxes/week3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions assets/shared/images/dialogue/boxes/week3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Text Box Appear
Text Box Appear
10 changes: 10 additions & 0 deletions assets/shared/images/dialogue/boxes/week3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="dialogueBox-pixel.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Text Box Appear instance 10000" x="0" y="0" width="249" height="144"/>
<SubTexture name="Text Box Appear instance 10001" x="259" y="0" width="249" height="144"/>
<SubTexture name="Text Box Appear instance 10002" x="0" y="154" width="249" height="144"/>
<SubTexture name="Text Box Appear instance 10003" x="259" y="154" width="249" height="144"/>
<SubTexture name="Text Box Appear instance 10004" x="259" y="154" width="249" height="144"/>
</TextureAtlas>
Binary file added assets/shared/images/dialogue/boxes/week5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions assets/shared/images/dialogue/boxes/week5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Text Box Appear
Text Box Appear
10 changes: 10 additions & 0 deletions assets/shared/images/dialogue/boxes/week5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="dialogueBox-pixel.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Text Box Appear instance 10000" x="0" y="0" width="249" height="144"/>
<SubTexture name="Text Box Appear instance 10001" x="259" y="0" width="249" height="144"/>
<SubTexture name="Text Box Appear instance 10002" x="0" y="154" width="249" height="144"/>
<SubTexture name="Text Box Appear instance 10003" x="259" y="154" width="249" height="144"/>
<SubTexture name="Text Box Appear instance 10004" x="259" y="154" width="249" height="144"/>
</TextureAtlas>
6 changes: 6 additions & 0 deletions assets/shared/images/dialogue/characters/SYNTAX.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Animation Name
Right X-Offset
Right Y-Offset
Left X-Offset
Left Y-Offset
Flip
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/shared/images/dialogue/characters/bf-christmas.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Boyfriend portrait enter
0
40
-20
40
false
14 changes: 14 additions & 0 deletions assets/shared/images/dialogue/characters/bf-christmas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="bfPortrait.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Boyfriend portrait enter instance 10000" x="0" y="0" width="249" height="145"/>
<SubTexture name="Boyfriend portrait enter instance 10001" x="259" y="0" width="249" height="145"/>
<SubTexture name="Boyfriend portrait enter instance 10002" x="259" y="0" width="249" height="145"/>
<SubTexture name="Boyfriend portrait enter instance 10003" x="0" y="155" width="249" height="145"/>
<SubTexture name="Boyfriend portrait enter instance 10004" x="0" y="155" width="249" height="145"/>
<SubTexture name="Boyfriend portrait enter instance 10005" x="259" y="155" width="249" height="145"/>
<SubTexture name="Boyfriend portrait enter instance 10006" x="259" y="155" width="249" height="145"/>
<SubTexture name="Boyfriend portrait enter instance 10007" x="259" y="155" width="249" height="145"/>
<SubTexture name="Boyfriend portrait enter instance 10008" x="259" y="155" width="249" height="145"/>
</TextureAtlas>
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,6 @@
Boyfriend portrait enter
0
40
-20
40
false
14 changes: 14 additions & 0 deletions assets/shared/images/dialogue/characters/parents-christmas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="senpaiPortrait.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Senpai Portrait Enter instance 10000" x="0" y="0" width="249" height="145"/>
<SubTexture name="Senpai Portrait Enter instance 10001" x="259" y="0" width="249" height="145"/>
<SubTexture name="Senpai Portrait Enter instance 10002" x="259" y="0" width="249" height="145"/>
<SubTexture name="Senpai Portrait Enter instance 10003" x="0" y="155" width="249" height="145"/>
<SubTexture name="Senpai Portrait Enter instance 10004" x="0" y="155" width="249" height="145"/>
<SubTexture name="Senpai Portrait Enter instance 10005" x="259" y="155" width="249" height="145"/>
<SubTexture name="Senpai Portrait Enter instance 10006" x="259" y="155" width="249" height="145"/>
<SubTexture name="Senpai Portrait Enter instance 10007" x="259" y="155" width="249" height="145"/>
<SubTexture name="Senpai Portrait Enter instance 10008" x="259" y="155" width="249" height="145"/>
</TextureAtlas>
52 changes: 45 additions & 7 deletions source/DialogueBox.hx
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,59 @@ class DialogueBox extends FlxSpriteGroup
hasDialog = true;
}

if (PlayState.hasDialogue) {
hasDialog = true;
var songConfig:Array<String> = CoolUtil.coolTextFile(Paths.txtImages("dialogue/boxes/songDBDefine"));
var songToDBMap:Map<String, String> = [];
for (i in 0...songConfig.length) {
var sussyMap = songConfig[i].trim().split('::');
songToDBMap.set(sussyMap[0].toLowerCase().trim(), sussyMap[1]);
}
var configFile:Array<String> = CoolUtil.coolTextFile(Paths.txtImages("dialogue/boxes/"+songToDBMap[PlayState.SONG.song.toLowerCase().trim()]));
box.frames = Paths.getSparrowAtlas('dialogue/boxes/'+songToDBMap[PlayState.SONG.song.toLowerCase().trim()]);
box.animation.addByPrefix('normalOpen', configFile[0], 24, false);
box.animation.addByIndices('normal', configFile[1], [4], "", 24);
}

this.dialogueList = dialogueList;

if (!hasDialog)
return;

portraitLeft = new FlxSprite(-20, 40);
portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait');
portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false);

if (!PlayState.hasDialogue) {
portraitLeft = new FlxSprite(-20, 40);
portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait');
portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false);
} else {
var configFile:Array<String> = CoolUtil.coolTextFile(Paths.txtImages("dialogue/characters/"+PlayState.SONG.player2));
portraitLeft = new FlxSprite(Std.parseFloat(configFile[3]), Std.parseFloat(configFile[4]));
portraitLeft.frames = Paths.getSparrowAtlas('dialogue/characters/'+PlayState.SONG.player2);
portraitLeft.animation.addByPrefix('enter', configFile[0], 24, false);
if (configFile[5] == "true")
portraitLeft.flipX = true;
else
portraitLeft.flipX = false;
}
portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9));
portraitLeft.updateHitbox();
portraitLeft.scrollFactor.set();
add(portraitLeft);
portraitLeft.visible = false;

portraitRight = new FlxSprite(0, 40);
portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait');
portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false);
if (!PlayState.hasDialogue) {
portraitRight = new FlxSprite(0, 40);
portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait');
portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false);
} else {
var configFile:Array<String> = CoolUtil.coolTextFile(Paths.txtImages("dialogue/characters/"+PlayState.SONG.player1));
portraitRight = new FlxSprite(Std.parseFloat(configFile[1]), Std.parseFloat(configFile[2]));
portraitRight.frames = Paths.getSparrowAtlas('dialogue/characters/'+PlayState.SONG.player1);
portraitRight.animation.addByPrefix('enter', configFile[0], 24, false);
if (configFile[5] == "true")
portraitRight.flipX = true;
else
portraitRight.flipX = false;
}
portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9));
portraitRight.updateHitbox();
portraitRight.scrollFactor.set();
Expand Down Expand Up @@ -159,9 +195,11 @@ class DialogueBox extends FlxSpriteGroup
{
// HARD CODING CUZ IM STUPDI
if (PlayState.SONG.song.toLowerCase() == 'roses')
{
portraitLeft.visible = false;
swagDialogue.color = FlxColor.WHITE;
dropText.color = FlxColor.BLACK;
}
if (PlayState.SONG.song.toLowerCase() == 'thorns')
{
portraitLeft.visible = false;
Expand Down
5 changes: 5 additions & 0 deletions source/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ class Paths
return getPath('data/$key.txt', TEXT, library);
}

inline static public function txtImages(key:String, ?library:String)
{
return getPath('images/$key.txt', TEXT, library);
}

inline static public function xml(key:String, ?library:String)
{
return getPath('data/$key.xml', TEXT, library);
Expand Down
3 changes: 2 additions & 1 deletion source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,8 @@ class PlayState extends MusicBeatState
case 'thorns':
schoolIntro(doof);
default:
startCountdown();
if (!hasDialogue)
startCountdown();
}

if (hasDialogue) {
Expand Down

0 comments on commit 51f4888

Please sign in to comment.