Log in
Please log in or register.
Pages: [1]
  Print  
Author Topic: FlxUtils  (Read 1779 times)
fefranca
Full Member
***
Posts: 218


10 binary lovers


View Profile WWW
« on: Tue, Dec 15, 2009 »

Hi everyone,

I decided to share a couple classes here with a very overwhelming name (I was going for FlxPOWERTOOLS but I thought that would be even more disappointing, heh).

I hope to add and remove classes as Flixel changes and incorporates some of the features displayed here. FlxUtils aren't direct modifications of the engine, just extensions and utilities (won't break everything, yay). Please feel free to contribute Smiley

  • FlxSpriteDebug: Shows handy FlxSprite collision boxes that change colors upon collision. This is very easy to use, just change your parent class name from FlxSprite to FlxSpriteDebug (and include the classpath).
  • FlxGradientBackground: A vertical gradient background for Flixel. Color properties (topColor and bottomColor) can be easily tweened for some awesome effects Smiley
  • FlxColoredBlock: Optimized version of a simple colored block. It accepts transparency. Btw cheers Rybar for the idea, I need to put your name there Tongue
  • FlxTilemapExt: Just something ugly, stay away.
  • FlxTextExt: Adds wordwrap, multiline and color outlining to FlxText.

Let me know what you think, check it out at:

http://github.com/fefranca/FlxUtils
« Last Edit: Wed, Jan 6, 2010 by fefranca » Logged

Free cake every day at #flixel on irc.freenode.net.
Use your favorite IRC client or  http://webchat.freenode.net/
Socapex
Full Member
***
Posts: 155


View Profile
« Reply #1 on: Tue, Dec 15, 2009 »

Hey thank you, the collision box, and the other box are going to be really useful, since I'm implementing my own (very very basic) collision system/attack boundary box which is modified per attack. So it'll be easier to test out the range. I'll post anything back here.

Cheers
Logged

Free cake every day at #flixel on irc.freenode.net.
Use your favorite IRC client or  http://webchat.freenode.net/
Adam Atomic
Administrator
Hero Member
*****
Posts: 724


hostest w/ the mostest


View Profile WWW
« Reply #2 on: Tue, Dec 15, 2009 »

nice!!  i wanna include the boudning box outlines as an official debug feature eventually, great stuff Cheesy
Logged

fefranca
Full Member
***
Posts: 218


10 binary lovers


View Profile WWW
« Reply #3 on: Tue, Dec 15, 2009 »

Thanks Adam and Socapex!

The debug sprite has helped me experiment with wall jumps and such, you can also call the showCollisionRects method for it to outline the tiles the sprite is colliding with.

EDIT:
Modified showCollisionRects. It doesn't need the tileSize parameter to work anymore (that was kind of dumb).

Sample usage:
myFlxSpriteDebug.showCollisionRects = true;
« Last Edit: Tue, Dec 15, 2009 by fefranca » Logged

Free cake every day at #flixel on irc.freenode.net.
Use your favorite IRC client or  http://webchat.freenode.net/
nitram_cero (2bam)
Sr. Member
****
Posts: 472



View Profile WWW
« Reply #4 on: Tue, Dec 15, 2009 »

Kickass!
I'll definetly be using the FlxColoredBlock  Smiley
Logged

2BAM
I Hate Islands, SpaceCoffee, Finding Her, Caverns, Explosive Cats, The Duke, Run, A View on Relationships, RabbitClock's Quest
Socapex
Full Member
***
Posts: 155


View Profile
« Reply #5 on: Wed, Dec 23, 2009 »

FlxSpriteDebug works like a marvel (can you say that in english?). Thanks a million, this should defenitely be added to a Flixel release.
Logged

Free cake every day at #flixel on irc.freenode.net.
Use your favorite IRC client or  http://webchat.freenode.net/
AtomicTroop
Newbie
*
Posts: 22


View Profile
« Reply #6 on: Sun, Dec 27, 2009 »

What is the proper way to use the FlxGradientBackground? I tried calling it with the usual
Code:
add(new FlxGradientBackground(0, 0, 208, 60000, 0xff99ffcc, 0xff003333));
Which compiles just fine but when the code actually runs, it throws a
Code:
[Fault] exception, information=ArgumentError: Error #2015: Invalid BitmapData.
I guess I'm not calling it correctly.
Logged
fefranca
Full Member
***
Posts: 218


10 binary lovers


View Profile WWW
« Reply #7 on: Mon, Jan 4, 2010 »

Hi AtomicTroop, sorry for the late reply, just got back from my holidays here.

The main problem with your code is that Flixel is trying to create a bitmap that has a height of 60000 pixels (out of bounds for Flash!). I understand what you are trying to do (probably a huge vertical game going up or down), so you should consider creating a FlxGradientBackground that is equivalent to the screen's size and do the following:

Code:
private var _background:FlxGradientBackground;

...

_background = new FlxGradientBackground(0, 0, FlxG.width, FlxG.height, 0xff99ffcc, 0xff003333)
add(_background);
And then change the background's colors dynamically inside the game with the color properties:
Code:
_background.topColor
_background.bottomColor

Here is a dumbed down idea for transitioning colors:
_background.topColor = _background.topColor - 0x00010101;
(you will need to set limits for this to work properly and call it every x frames).

Finally, you gave me a good idea I might actually try to implement (changing gradients according to background position). Anyways, let me know how that works for you Smiley

EDIT:
Just updated FlxUtils on GitHub so it works with Flixel 1.51. Have fun everyone Wink


EDIT2:
Added FlxTextExt to FlxUtils. Feature suggestions are very welcome!
« Last Edit: Wed, Jan 6, 2010 by fefranca » Logged

Free cake every day at #flixel on irc.freenode.net.
Use your favorite IRC client or  http://webchat.freenode.net/
fefranca
Full Member
***
Posts: 218


10 binary lovers


View Profile WWW
« Reply #8 on: Wed, Jan 6, 2010 »

Brand-new FlxTextExt, minor performance update to FlxGradientBackground
Logged

Free cake every day at #flixel on irc.freenode.net.
Use your favorite IRC client or  http://webchat.freenode.net/
AtomicTroop
Newbie
*
Posts: 22


View Profile
« Reply #9 on: Tue, Jan 12, 2010 »

Bumping up a bit.

Yeah, anyways that 60000 was actually a number that I whipped out of my head for a test, I just didn't consider the possibility of it being out of bounds. D: But I guess that fixed my problems, so thanks.
Logged
Dro
Jr. Member
**
Posts: 50



View Profile
« Reply #10 on: Sun, Feb 14, 2010 »

incompatible with newest Flixel version?
there's no FlxCore
Logged
gameGetter
Newbie
*
Posts: 21



View Profile
« Reply #11 on: Mon, Feb 15, 2010 »

Very excited about this!  Thanks a ton for sharing.  I've been wanting the bounding box utility, and this is a godsend Smiley

Cheers!
Logged

I dream in binary, and scream in digital
Pages: [1]
  Print  
 
Jump to: