ALMOST DIALOGUE

This commit is contained in:
Cameron Taylor 2020-10-30 23:30:35 -07:00
parent cc66469d30
commit a9ada001f7
9 changed files with 233 additions and 53 deletions

View File

@ -94,5 +94,5 @@
<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
<icon path="art/icon.png"/>
<!-- <haxedef name="SKIP_TO_PLAYSTATE" if="debug" /> -->
<haxedef name="SKIP_TO_PLAYSTATE" if="debug" />
</project>

BIN
art/halloween_bg.fla Normal file

Binary file not shown.

View File

@ -2,14 +2,14 @@
<TextureAtlas imagePath="alphabet.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="#0000" x="0" y="0" width="39" height="44"/>
<SubTexture name="#0001" x="0" y="0" width="39" height="44"/>
<SubTexture name="#0002" x="49" y="0" width="39" height="44"/>
<SubTexture name="#0003" x="49" y="0" width="39" height="44"/>
<SubTexture name="$0000" x="98" y="0" width="40" height="64"/>
<SubTexture name="$0001" x="98" y="0" width="40" height="64"/>
<SubTexture name="$0002" x="148" y="0" width="39" height="63" frameX="0" frameY="0" frameWidth="40" frameHeight="64"/>
<SubTexture name="$0003" x="148" y="0" width="39" height="63" frameX="0" frameY="0" frameWidth="40" frameHeight="64"/>
<SubTexture name="hashtag 0000" x="0" y="0" width="39" height="44"/>
<SubTexture name="hashtag 0001" x="0" y="0" width="39" height="44"/>
<SubTexture name="hashtag 0002" x="49" y="0" width="39" height="44"/>
<SubTexture name="hashtag 0003" x="49" y="0" width="39" height="44"/>
<SubTexture name="dollarsign 0000" x="98" y="0" width="40" height="64"/>
<SubTexture name="dollarsign 0001" x="98" y="0" width="40" height="64"/>
<SubTexture name="dollarsign 0002" x="148" y="0" width="39" height="63" frameX="0" frameY="0" frameWidth="40" frameHeight="64"/>
<SubTexture name="dollarsign 0003" x="148" y="0" width="39" height="63" frameX="0" frameY="0" frameWidth="40" frameHeight="64"/>
<SubTexture name="%0000" x="197" y="0" width="46" height="52"/>
<SubTexture name="%0001" x="197" y="0" width="46" height="52"/>
<SubTexture name="%0002" x="253" y="0" width="45" height="52" frameX="0" frameY="0" frameWidth="46" frameHeight="52"/>
@ -106,10 +106,10 @@
<SubTexture name="A bold0001" x="219" y="141" width="54" height="67"/>
<SubTexture name="A bold0002" x="283" y="141" width="54" height="67"/>
<SubTexture name="A bold0003" x="283" y="141" width="54" height="67"/>
<SubTexture name="A captial0000" x="347" y="141" width="45" height="59"/>
<SubTexture name="A captial0001" x="347" y="141" width="45" height="59"/>
<SubTexture name="A captial0002" x="402" y="141" width="45" height="59"/>
<SubTexture name="A captial0003" x="402" y="141" width="45" height="59"/>
<SubTexture name="A capital0000" x="347" y="141" width="45" height="59"/>
<SubTexture name="A capital0001" x="347" y="141" width="45" height="59"/>
<SubTexture name="A capital0002" x="402" y="141" width="45" height="59"/>
<SubTexture name="A capital0003" x="402" y="141" width="45" height="59"/>
<SubTexture name="B bold0000" x="457" y="141" width="46" height="70"/>
<SubTexture name="B bold0001" x="457" y="141" width="46" height="70"/>
<SubTexture name="B bold0002" x="513" y="141" width="46" height="70"/>
@ -178,10 +178,10 @@
<SubTexture name="J bold0001" x="145" y="301" width="54" height="70"/>
<SubTexture name="J bold0002" x="209" y="301" width="54" height="70"/>
<SubTexture name="J bold0003" x="209" y="301" width="54" height="70"/>
<SubTexture name="J captial0000" x="273" y="301" width="39" height="54"/>
<SubTexture name="J captial0001" x="273" y="301" width="39" height="54"/>
<SubTexture name="J captial0002" x="322" y="301" width="39" height="54"/>
<SubTexture name="J captial0003" x="322" y="301" width="39" height="54"/>
<SubTexture name="J capital0000" x="273" y="301" width="39" height="54"/>
<SubTexture name="J capital0001" x="273" y="301" width="39" height="54"/>
<SubTexture name="J capital0002" x="322" y="301" width="39" height="54"/>
<SubTexture name="J capital0003" x="322" y="301" width="39" height="54"/>
<SubTexture name="K bold0000" x="371" y="301" width="44" height="69"/>
<SubTexture name="K bold0001" x="371" y="301" width="44" height="69"/>
<SubTexture name="K bold0002" x="425" y="301" width="44" height="69"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 MiB

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="halloween_bg.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="halloweem bg0000" x="0" y="0" width="2114" height="1075"/>
<SubTexture name="halloweem bg lightning strike0000" x="2124" y="0" width="2114" height="1075" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0001" x="4248" y="0" width="2114" height="1000" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0002" x="0" y="1085" width="2114" height="1090"/>
<SubTexture name="halloweem bg lightning strike0003" x="2124" y="1085" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0004" x="4248" y="1085" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0005" x="4248" y="1085" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0006" x="0" y="2185" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0007" x="2124" y="2185" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0008" x="4248" y="2185" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0009" x="0" y="3276" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0010" x="2124" y="3276" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0011" x="4248" y="3276" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0012" x="0" y="4366" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0013" x="2124" y="4366" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0014" x="4248" y="4366" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0015" x="0" y="5456" width="2114" height="1079" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0016" x="2124" y="5456" width="2114" height="1079" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0017" x="4248" y="5456" width="2114" height="1079" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0018" x="0" y="6545" width="2114" height="1079" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0019" x="2124" y="6545" width="2114" height="1078" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0020" x="4248" y="6545" width="2114" height="1078" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
<SubTexture name="halloweem bg lightning strike0029" x="0" y="0" width="2114" height="1075"/>
</TextureAtlas>

View File

@ -34,20 +34,26 @@ class Alphabet extends FlxSpriteGroup
var splitWords:Array<String> = [];
var isBold:Bool = false;
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false)
{
super(x, y);
_finalText = text;
this.text = text;
isBold = bold;
if (typed)
if (text != "")
{
startTypedText();
}
else
{
addText();
if (typed)
{
startTypedText();
}
else
{
addText();
}
}
}
@ -71,7 +77,7 @@ class Alphabet extends FlxSpriteGroup
var xPos:Float = 0;
if (lastSprite != null)
{
xPos = lastSprite.x + lastSprite.frameWidth;
xPos = lastSprite.x + lastSprite.width - 40;
}
if (lastWasSpace)
@ -82,7 +88,12 @@ class Alphabet extends FlxSpriteGroup
// var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
letter.createBold(character);
if (isBold)
letter.createBold(character);
else
letter.createLetter(character);
add(letter);
lastSprite = letter;
@ -106,10 +117,10 @@ class Alphabet extends FlxSpriteGroup
var loopNum:Int = 0;
var xPos:Float = 0;
new FlxTimer().start(0.05, function(tmr:FlxTimer)
{
var xPos:Float = 0;
// trace(_finalText.fastCodeAt(loopNum) + " " + _finalText.charAt(loopNum));
if (_finalText.fastCodeAt(loopNum) == "\n".code)
{
@ -118,22 +129,44 @@ class Alphabet extends FlxSpriteGroup
// xPos = 0;
}
if (splitWords[loopNum] == " ")
{
lastWasSpace = true;
}
if (AlphaCharacter.alphabet.contains(splitWords[loopNum].toLowerCase()))
{
if (lastSprite != null && !xPosResetted)
{
xPos = lastSprite.x + lastSprite.frameWidth - 40;
lastSprite.updateHitbox();
xPos += lastSprite.width + 3;
// if (isBold)
// xPos -= 80;
}
else
{
xPosResetted = false;
}
if (lastWasSpace)
{
xPos += 20;
lastWasSpace = false;
}
// trace(_finalText.fastCodeAt(loopNum) + " " + _finalText.charAt(loopNum));
// var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
var letter:AlphaCharacter = new AlphaCharacter(xPos, 55 * yMulti);
letter.createBold(splitWords[loopNum]);
if (isBold)
{
letter.createBold(splitWords[loopNum]);
}
else
{
letter.createLetter(splitWords[loopNum]);
letter.x += 90;
}
add(letter);
lastSprite = letter;
@ -141,7 +174,7 @@ class Alphabet extends FlxSpriteGroup
loopNum += 1;
tmr.time = FlxG.random.float(0.03, 0.09);
tmr.time = FlxG.random.float(0.05, 0.12);
}, splitWords.length);
}
@ -184,5 +217,6 @@ class AlphaCharacter extends FlxSprite
animation.addByPrefix(letter, letter + " " + letterCase, 24);
animation.play(letter);
updateHitbox();
}
}

86
source/DialogueBox.hx Normal file
View File

@ -0,0 +1,86 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxSpriteGroup;
import flixel.input.FlxKeyManager;
class DialogueBox extends FlxSpriteGroup
{
var box:FlxSprite;
var dialogue:Alphabet;
var dialogueList:Array<String> = [];
public var finishThing:Void->Void;
public function new(talkingRight:Bool = true, ?dialogueList:Array<String>)
{
super();
box = new FlxSprite(40);
box.frames = FlxAtlasFrames.fromSparrow(AssetPaths.speech_bubble_talking__png, AssetPaths.speech_bubble_talking__xml);
box.animation.addByPrefix('normalOpen', 'Speech Bubble Normal Open', 24, false);
box.animation.addByPrefix('normal', 'speech bubble normal', 24);
box.animation.play('normalOpen');
add(box);
if (!talkingRight)
{
box.flipX = true;
}
dialogue = new Alphabet(0, 80, "", false, true);
// dialogue.x = 90;
add(dialogue);
this.dialogueList = dialogueList;
}
var dialogueOpened:Bool = false;
var dialogueStarted:Bool = false;
override function update(elapsed:Float)
{
if (box.animation.curAnim != null)
{
if (box.animation.curAnim.name == 'normalOpen' && box.animation.curAnim.finished)
{
box.animation.play('normal');
dialogueOpened = true;
}
}
if (dialogueOpened && !dialogueStarted)
{
startDialogue();
dialogueStarted = true;
}
if (FlxG.keys.justPressed.SPACE)
{
remove(dialogue);
if (dialogueList[1] == null)
{
finishThing();
kill();
}
else
{
dialogueList.remove(dialogueList[0]);
startDialogue();
}
}
super.update(elapsed);
}
function startDialogue():Void
{
var theDialog:Alphabet = new Alphabet(0, 70, dialogueList[0], false, true);
dialogue = theDialog;
add(theDialog);
}
}

View File

@ -38,6 +38,8 @@ class PlayState extends MusicBeatState
public static var isStoryMode:Bool = false;
public static var storyPlaylist:Array<String> = [];
var halloweenLevel:Bool = false;
private var vocals:FlxSound;
private var dad:Character;
@ -71,6 +73,10 @@ class PlayState extends MusicBeatState
private var camHUD:FlxCamera;
private var camGame:FlxCamera;
var dialogue:Array<String> = ['blah blah blah', 'coolswag'];
var halloweenBG:FlxSprite;
override public function create()
{
// var gameCam:FlxCamera = FlxG.camera;
@ -91,28 +97,47 @@ class PlayState extends MusicBeatState
Conductor.changeBPM(SONG.bpm);
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.stageback__png);
// bg.setGraphicSize(Std.int(bg.width * 2.5));
// bg.updateHitbox();
bg.antialiasing = true;
bg.scrollFactor.set(0.9, 0.9);
bg.active = false;
add(bg);
if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south')
{
halloweenLevel = true;
var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(AssetPaths.stagefront__png);
stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));
stageFront.updateHitbox();
stageFront.antialiasing = true;
stageFront.scrollFactor.set(0.9, 0.9);
stageFront.active = false;
add(stageFront);
var hallowTex = FlxAtlasFrames.fromSparrow(AssetPaths.halloween_bg__png, AssetPaths.halloween_bg__xml);
var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(AssetPaths.stagecurtains__png);
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
stageCurtains.updateHitbox();
stageCurtains.antialiasing = true;
stageCurtains.scrollFactor.set(1.3, 1.3);
stageCurtains.active = false;
halloweenBG = new FlxSprite(-200, -100);
halloweenBG.frames = hallowTex;
halloweenBG.animation.addByPrefix('idle', 'halloweem bg0');
halloweenBG.animation.addByPrefix('lightning', 'halloweem bg lightning strike', 24, false);
halloweenBG.animation.play('idle');
halloweenBG.antialiasing = true;
add(halloweenBG);
}
else
{
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(AssetPaths.stageback__png);
// bg.setGraphicSize(Std.int(bg.width * 2.5));
// bg.updateHitbox();
bg.antialiasing = true;
bg.scrollFactor.set(0.9, 0.9);
bg.active = false;
add(bg);
var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(AssetPaths.stagefront__png);
stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));
stageFront.updateHitbox();
stageFront.antialiasing = true;
stageFront.scrollFactor.set(0.9, 0.9);
stageFront.active = false;
add(stageFront);
var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(AssetPaths.stagecurtains__png);
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
stageCurtains.updateHitbox();
stageCurtains.antialiasing = true;
stageCurtains.scrollFactor.set(1.3, 1.3);
stageCurtains.active = false;
add(stageCurtains);
}
gf = new Character(400, 130, 'gf');
gf.scrollFactor.set(0.95, 0.95);
@ -136,7 +161,14 @@ class PlayState extends MusicBeatState
boyfriend = new Boyfriend(770, 450);
add(boyfriend);
add(stageCurtains);
var doof:DialogueBox = new DialogueBox(false, dialogue);
// doof.x += 70;
doof.y = FlxG.height * 0.5;
doof.scrollFactor.set();
doof.finishThing = startCountdown;
add(doof);
Conductor.songPosition = -5000;
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
strumLine.scrollFactor.set();
@ -148,7 +180,7 @@ class PlayState extends MusicBeatState
startingSong = true;
startCountdown();
// startCountdown();
generateSong(SONG.song);

View File

@ -51,7 +51,7 @@ class TitleState extends MusicBeatState
super.create();
#if SKIP_TO_PLAYSTATE
FlxG.switchState(new MainMenuState());
FlxG.switchState(new PlayState());
#else
startIntro();
#end