Author Topic: FlxDialog  (Read 5413 times)

ShooterMG

  • Member
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
FlxDialog
« on: Wed, Jun 16, 2010 »
Hey everyone, just thought I'd post my dialog class that I created for my games. It should be fairly non-intrusive for you to implement. It's also pretty bare bones, doing the absolute minimum as far as features. But feel free to add to it/make adjustments

Here's how it works. You would generally create a member instance of FlxDialog in your state.

Wrap your update function in something like this:

override public function update():void
{
      if(!dialog.showing)
      {
             //do your regular update stuff
      }
      else
      {
           dialog.update(); //update the dialog
      }
}

You can also pass it a function to call when the dialog is finished

dialog.finishCallback = myFunction;

You can press "X" during the 'scrolling' of the dialog to just show the whole sentence, and pressing "X" again will either start displaying the next page, or close it as necessary. It's probably not optimized or the best, but at least it's free and you can fix it if you want.
http://www.gamesnw.com/flixel/org/flixel/FlxDialog.as

bobbybaker82

  • Active Member
  • ***
  • Posts: 155
  • Karma: +0/-0
    • View Profile
Re: FlxDialog
« Reply #1 on: Fri, Jun 18, 2010 »
Cool stuff, I"m going to use this in my current game, thanks :)

blackletter

  • Member
  • **
  • Posts: 27
  • Karma: +0/-0
  • 1 + 1 = 10
    • View Profile
Re: FlxDialog
« Reply #2 on: Wed, Jun 23, 2010 »
Wow another nice addon for flixel. I will try it in my next game ^^
Free cake every day at #flixel on irc.freenode.net.
Use your favorite IRC client or  http://webchat.freenode.net/

GordonCSA

  • Member
  • **
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: FlxDialog
« Reply #3 on: Wed, Jul 7, 2010 »
Well how useful, I was just trying to figure out a way to do this.  :D
I agree it is quite easy to make adjustments, but one change I would make in the default version is to have the widths of the text/background boxes be something like 'FlxG.width-5' by default.

Tyranus

  • Member
  • **
  • Posts: 54
  • Karma: +0/-0
    • View Profile
    • Tyranus:: Indie Games.
Re: FlxDialog
« Reply #4 on: Wed, Jul 7, 2010 »
I made for my current game a very similar class. Let me make a sugges to you, a simple and usefull line:

Code: [Select]
if (FlxG.keyboard.justPressed("Z") && FlxG.debug) {
     skip dialog.
     callback function
}

Greetings!

Kronoshifter

  • Member
  • **
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: FlxDialog
« Reply #5 on: Tue, Oct 12, 2010 »
This is great. Props for this. I did change just a few things though. I think Vectors are faster than Arrays in the case of strings, so I made the _dialogArray a Vector. That also actually helps flash with index access, since an array can contain anything, flash has to try and figure out that you're using a string, whereas with a Vector it already knows that it has to be a string, and makes it that much easier for flash. Just my 2 cents.