dialogues stuff & porting WIP 2
kinda rushed today sorryyy
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<dialoguebox y="75">
|
||||
<!--
|
||||
Node containing all text settings
|
||||
-->
|
||||
-->
|
||||
<text font="vcr.ttf" x="107" y="206" width="1053" color="#000000" size="40"/>
|
||||
|
||||
<!--
|
||||
@@ -15,7 +15,7 @@
|
||||
<!--
|
||||
All animations for the dialogue box
|
||||
For example, if you wanna add an "angry" animation, add an animation named "angry" (box idle), and "angry-open" (not needed, for box apparition)
|
||||
-->
|
||||
-->
|
||||
<anim name="normal" anim="speech bubble normal" fps="24" loop="true" x="-30"/>
|
||||
<anim name="normal-open" anim="Speech Bubble Normal Open" fps="24" />
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<dialoguebox sprite="pixel/dialogueBox" antialiasing="false" graphicSizex="1344" x="20" y="-215" textSound="pixel/pixelText" nextSound="pixel/clickText">
|
||||
<!--
|
||||
Node containing all text settings
|
||||
-->
|
||||
<text x="242" y="218" width="768" color="#3f2021" size="32" antialiasing="false" borderSize="2" borderStyle="shadow" borderColor="#D89494" />
|
||||
-->
|
||||
<text font="pixel.otf" x="242" y="218" width="768" color="#3f2021" size="32" antialiasing="false" borderSize="2" borderStyle="shadow" borderColor="#D89494" />
|
||||
|
||||
<!--
|
||||
All positions for characters
|
||||
@@ -15,7 +15,7 @@
|
||||
<!--
|
||||
All animations for the dialogue box
|
||||
For example, if you wanna add an "angry" animation, add an animation named "angry" (box idle), and "angry-open" (not needed, for box apparition)
|
||||
-->
|
||||
-->
|
||||
<anim name="normal" anim="Text Box Appear instance 10004" fps="24" loop="true"/>
|
||||
<anim name="normal-open" anim="Text Box Appear instance 10" fps="24" />
|
||||
</dialoguebox>
|
||||
@@ -0,0 +1,4 @@
|
||||
<!DOCTYPE codename-engine-dialogue-character>
|
||||
<character sprite="pixel/senpai" x="-392" y="-599" graphicSizex="1334" antialiasing="false" >
|
||||
<anim name="show" anim="Senpai Portrait Enter instance 10" fps="24" />
|
||||
</character>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 5.7 KiB |
@@ -1,10 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextureAtlas imagePath="dialogueBox.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>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Created with Funkin Packer v0.1.3 https://neeeoo.github.io/funkin-packer/
|
||||
-->
|
||||
<TextureAtlas imagePath="dialogueBox.png" width="207" height="158">
|
||||
<SubTexture name="Text Box Appear instance 10000" x="1" y="143" width="202" height="14" frameX="-22" frameY="-62" frameWidth="249" frameHeight="144"/>
|
||||
<SubTexture name="Text Box Appear instance 10001" x="1" y="111" width="204" height="29" frameX="-22" frameY="-64" frameWidth="249" frameHeight="144"/>
|
||||
<SubTexture name="Text Box Appear instance 10002" x="1" y="62" width="204" height="46" frameX="-22" frameY="-65" frameWidth="249" frameHeight="144"/>
|
||||
<SubTexture name="Text Box Appear instance 10003" x="1" y="1" width="205" height="58" frameX="-22" frameY="-66" frameWidth="249" frameHeight="144"/>
|
||||
<SubTexture name="Text Box Appear instance 10004" x="1" y="1" width="205" height="58" frameX="-22" frameY="-66" frameWidth="249" frameHeight="144"/>
|
||||
</TextureAtlas>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Created with Funkin Packer v0.1.3 https://neeeoo.github.io/funkin-packer/
|
||||
-->
|
||||
<TextureAtlas imagePath="boyfriend.png" width="243" height="47">
|
||||
<SubTexture name="Boyfriend portrait enter instance 10000" x="1" y="1" width="58" height="45" frameX="-157" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Boyfriend portrait enter instance 10001" x="62" y="1" width="58" height="45" frameX="-150" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Boyfriend portrait enter instance 10002" x="62" y="1" width="58" height="45" frameX="-150" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Boyfriend portrait enter instance 10003" x="123" y="1" width="58" height="45" frameX="-144" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Boyfriend portrait enter instance 10004" x="123" y="1" width="58" height="45" frameX="-144" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Boyfriend portrait enter instance 10005" x="184" y="1" width="58" height="45" frameX="-143" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Boyfriend portrait enter instance 10006" x="184" y="1" width="58" height="45" frameX="-143" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Boyfriend portrait enter instance 10007" x="184" y="1" width="58" height="45" frameX="-143" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Boyfriend portrait enter instance 10008" x="184" y="1" width="58" height="45" frameX="-143" frameY="-30" frameWidth="249" frameHeight="145"/>
|
||||
</TextureAtlas>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Created with Funkin Packer v0.1.3 https://neeeoo.github.io/funkin-packer/
|
||||
-->
|
||||
<TextureAtlas imagePath="senpai.png" width="53" height="239">
|
||||
<SubTexture name="Senpai Portrait Enter instance 10000" x="1" y="1" width="51" height="57" frameX="-38" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Senpai Portrait Enter instance 10001" x="1" y="61" width="51" height="57" frameX="-45" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Senpai Portrait Enter instance 10002" x="1" y="61" width="51" height="57" frameX="-45" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Senpai Portrait Enter instance 10003" x="1" y="121" width="51" height="57" frameX="-48" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Senpai Portrait Enter instance 10004" x="1" y="121" width="51" height="57" frameX="-48" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Senpai Portrait Enter instance 10005" x="1" y="181" width="51" height="57" frameX="-49" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Senpai Portrait Enter instance 10006" x="1" y="181" width="51" height="57" frameX="-49" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Senpai Portrait Enter instance 10007" x="1" y="181" width="51" height="57" frameX="-49" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
<SubTexture name="Senpai Portrait Enter instance 10008" x="1" y="181" width="51" height="57" frameX="-49" frameY="-17" frameWidth="249" frameHeight="145"/>
|
||||
</TextureAtlas>
|
||||
@@ -1,14 +1,14 @@
|
||||
<!DOCTYPE codename-engine-dialogue>
|
||||
<dialogue box="senpai">
|
||||
<!-- All characters -->
|
||||
<char name="dad" char="dad" position="left" />
|
||||
<char name="senpai" char="senpai" position="left" />
|
||||
<char name="boyfriend" char="boyfriend" position="right" />
|
||||
|
||||
<!-- Lines -->
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
Not bad for an ugly worm.
|
||||
</line>
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
But this time I'll rip your nuts off right after your girlfriend finishes gargling mine.
|
||||
</line>
|
||||
<line char="boyfriend">
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<!DOCTYPE codename-engine-dialogue>
|
||||
<dialogue box="senpai">
|
||||
<!-- All characters -->
|
||||
<char name="dad" char="dad" position="left" />
|
||||
<char name="senpai" char="senpai" position="left" />
|
||||
<char name="boyfriend" char="boyfriend" position="right" />
|
||||
|
||||
<!-- Lines -->
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
Ah, a new fair maiden has come in search of true love!
|
||||
</line>
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
A serenade between gentlemen shall decide where her beautiful heart shall reside.
|
||||
</line>
|
||||
<line char="boyfriend">
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<!DOCTYPE codename-engine-dialogue>
|
||||
<dialogue box="senpai">
|
||||
<!-- All characters -->
|
||||
<char name="dad" char="dad" position="left" />
|
||||
<char name="senpai" char="senpai" position="left" />
|
||||
|
||||
<!-- Lines -->
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
Direct contact with real humans, after being trapped in here for so long...
|
||||
</line>
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
and HER of all people.
|
||||
</line>
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
I'll make her father pay for what he's done to me and all the others,,,,
|
||||
</line>
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
I'll beat you and make you take my place.
|
||||
</line>
|
||||
<line char="dad">
|
||||
<line char="senpai">
|
||||
You don't mind your bodies being borrowed right? It's only fair...
|
||||
</line>
|
||||
</dialogue>
|
||||
@@ -1,10 +1,9 @@
|
||||
package funkin.backend.utils;
|
||||
|
||||
import flixel.animation.FlxAnimation;
|
||||
import funkin.backend.FunkinSprite;
|
||||
import funkin.backend.system.ErrorCode;
|
||||
import funkin.backend.FunkinSprite.XMLAnimType;
|
||||
import funkin.backend.system.interfaces.IBeatReceiver;
|
||||
import flixel.util.FlxColor;
|
||||
import haxe.xml.Access;
|
||||
import funkin.backend.system.interfaces.IOffsetCompatible;
|
||||
|
||||
@@ -138,12 +137,15 @@ class XMLUtil {
|
||||
}
|
||||
if (node.has.updateHitbox && node.att.updateHitbox == "true") spr.updateHitbox();
|
||||
|
||||
if(node.has.zoomfactor)
|
||||
if (node.has.zoomfactor)
|
||||
spr.zoomFactor = Std.parseFloat(node.getAtt("zoomfactor")).getDefault(spr.zoomFactor);
|
||||
|
||||
if (node.has.alpha)
|
||||
spr.alpha = Std.parseFloat(node.getAtt("alpha")).getDefault(spr.alpha);
|
||||
|
||||
if(node.has.color)
|
||||
spr.color = FlxColor.fromString(node.getAtt("color")).getDefault(0xFFFFFFFF);
|
||||
|
||||
if (node.has.playOnCountdown)
|
||||
spr.skipNegativeBeats = node.att.playOnCountdown == "true";
|
||||
if (node.has.beatInterval)
|
||||
|
||||
@@ -48,6 +48,7 @@ class DialogueBox extends FunkinSprite {
|
||||
text.color = textNode.getAtt("color").getColorFromDynamic().getDefault(0xFF000000);
|
||||
text.size = Std.parseInt(textNode.att.size).getDefault(20);
|
||||
text.font = Paths.font('${textNode.getAtt("font").getDefault("vcr.ttf")}');
|
||||
text.delay = Std.parseFloat(textNode.getAtt("delay")).getDefault(0.05);
|
||||
text.antialiasing = textNode.getAtt("antialiasing").getDefault("false") == "true";
|
||||
text.sounds = [FlxG.sound.load(textTypeSFX)];
|
||||
if(textNode.has.borderStyle) {
|
||||
|
||||
@@ -6,23 +6,30 @@ import haxe.xml.Access;
|
||||
class DialogueCharacter extends FunkinSprite {
|
||||
public var charData:Access;
|
||||
public var curTween:FlxTween;
|
||||
public var curTweenContext:DialogueCharTweenContext = NONE;
|
||||
public var curAnimContext:DialogueCharAnimContext = NONE;
|
||||
public var positionName:String;
|
||||
public var finishCallback:String->Void = null;
|
||||
|
||||
public function new(name:String, position:String) {
|
||||
super();
|
||||
this.positionName = position;
|
||||
try {
|
||||
charData = new Access(Xml.parse(Assets.getText(Paths.xml('dialogue/characters/$name'))).firstElement());
|
||||
loadSprite(Paths.image('dialogue/characters/${charData.getAtt('sprite').getDefault(name)}'));
|
||||
antialiasing = charData.getAtt('antialiasing').getDefault('true') == 'true';
|
||||
scale.scale(charData.has.scale ? Std.parseFloat(charData.att.scale).getDefault(1) : 1);
|
||||
updateHitbox();
|
||||
offset.set(
|
||||
charData.has.x ? Std.parseFloat(charData.att.x).getDefault(0) : 0,
|
||||
(charData.has.y ? Std.parseFloat(charData.att.y).getDefault(0) : 0) + this.height);
|
||||
for(anim in charData.nodes.anim)
|
||||
XMLUtil.addXMLAnimation(this, anim, true);
|
||||
if(!charData.has.sprite) charData.x.set("sprite", name);
|
||||
if(!charData.has.updateHitbox) charData.x.set("updateHitbox", "true");
|
||||
XMLUtil.loadSpriteFromXML(this, charData, "dialogue/characters/", LOOP);
|
||||
|
||||
animation.finishCallback = (name:String) -> {
|
||||
switch(name)
|
||||
{
|
||||
case 'show': hasAnimation('normal') ? playAnim('normal', true) : animation.stop();
|
||||
case 'hide': alpha = 0;
|
||||
}
|
||||
if(finishCallback != null) finishCallback(name);
|
||||
}
|
||||
|
||||
offset.set(x, y + height);
|
||||
x = 0; y = 0;
|
||||
} catch(e) {
|
||||
Logs.trace('Failed to load dialogue character $name: ${e.toString()}', ERROR);
|
||||
}
|
||||
@@ -30,29 +37,33 @@ class DialogueCharacter extends FunkinSprite {
|
||||
}
|
||||
|
||||
public function show(x:Float, y:Float) {
|
||||
if (curTweenContext != (curTweenContext = POPIN)) {
|
||||
setPosition(x, y + 100);
|
||||
if (curTween != null)
|
||||
curTween.cancel();
|
||||
if (curAnimContext == (curAnimContext = POPIN)) return;
|
||||
|
||||
if (hasAnimation('show')) {
|
||||
playAnim('show', true);
|
||||
setPosition(x, y);
|
||||
} else {
|
||||
setPosition(x, y + 100);
|
||||
if(curTween != null) curTween.cancel();
|
||||
playAnim('normal', true);
|
||||
alpha = 0;
|
||||
visible = true;
|
||||
|
||||
curTween = FlxTween.tween(this, {alpha: 1, y: y}, 0.2, {ease: FlxEase.quintOut});
|
||||
}
|
||||
visible = true;
|
||||
}
|
||||
|
||||
public function hide() {
|
||||
if (curTweenContext != (curTweenContext = POPOUT)) {
|
||||
if (curTween != null)
|
||||
curTween.cancel();
|
||||
|
||||
if (curAnimContext == (curAnimContext = POPOUT)) return;
|
||||
|
||||
if(hasAnimation('hide')) playAnim('hide', true);
|
||||
else {
|
||||
if(curTween != null) curTween.cancel();
|
||||
curTween = FlxTween.tween(this, {alpha: 0, y: y + 100}, 0.2, {ease: FlxEase.quintIn});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum abstract DialogueCharTweenContext(Int) {
|
||||
enum abstract DialogueCharAnimContext(Int) {
|
||||
var NONE = -1;
|
||||
var POPIN = 0;
|
||||
var POPOUT = 1;
|
||||
|
||||
Reference in New Issue
Block a user