Author Topic: Flixel Power Tools  (Read 74587 times)

tomii

  • Active Member
  • ***
  • Posts: 108
  • Karma: +0/-0
    • View Profile
Re: Flixel Power Tools
« Reply #20 on: Tue, Jun 21, 2011 »
The main problem (for me at least), might be that people are expecting the align feature to work like in Illustrator or whatever, so it might seem odd why it's not working like this at first.

I think I now understand what you mean about the "Sprite's width" and stuff, now when I read your post again.

Thanks for the help!
My online portfolio // www.tomii.se
My twitter

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flixel Power Tools
« Reply #21 on: Tue, Jun 21, 2011 »
Ok I have updated FPT on github dev branch. Grab the new FlxBitmapFont class (and the updated test BitmapFontTest3). You can now set a fixed width for the sprite and use the align parameter to control where the text is written. Example:

Code: [Select]
font1 = new FlxBitmapFont(AssetsRegistry.knightHawksPurpleFontPNG, 31, 25, FlxBitmapFont.TEXT_SET6, 10, 1, 1);
font1.setFixedWidth(290, FlxBitmapFont.ALIGN_RIGHT);

This gives the resulting sprite (which is what font really is) a width of 290px regardless of the text inside it, and the text is aligned to the right of that width.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

tomii

  • Active Member
  • ***
  • Posts: 108
  • Karma: +0/-0
    • View Profile
Re: Flixel Power Tools
« Reply #22 on: Tue, Jun 21, 2011 »
Awesome!! I'll give it a go!
Btw, it wouldn't be possible to update the sprite's width in real time, would it?
Then you could do something like...

abc.Spritewidth = (abc.charW * String(abc.text).length);

and then in the update or render function or whatever you check to see if the length of the String is the same as last update - and skip the update if it IS - to save some CPU power.
My online portfolio // www.tomii.se
My twitter

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flixel Power Tools
« Reply #23 on: Tue, Jun 21, 2011 »
You can change the width as often as you like, but it won't take effect until the next call to either setText or text =
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

tomii

  • Active Member
  • ***
  • Posts: 108
  • Karma: +0/-0
    • View Profile
Re: Flixel Power Tools
« Reply #24 on: Tue, Jun 21, 2011 »
I tested the new FlxBitmap and it works really good! You da man! - as always :D
The only adjustment I had to do was...

Code: [Select]
scoreFont.setFixedWidth(140, FlxBitmapFont.ALIGN_RIGHT);
scoreFont.x = scoreFontX -140;
scoreFont.y = scoreFontY;

When I was using the master-branch version, I used a variable to set it's x and y position, but as you can see I had to add -140 for it to appear at the same spot again. Maybe it's just natural? :p
But anyhow, this new feature is very nice, and I thank you for adding it so quickly!

My online portfolio // www.tomii.se
My twitter

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flixel Power Tools
« Reply #25 on: Tue, Jun 21, 2011 »
scoreFont.x will set the sprite location based on the top-left corner of it. I've no idea what your scoreFontX variable holds, but if it's the right-hand side of the area in which you want the text to appear, change it to the left :)
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

tomii

  • Active Member
  • ***
  • Posts: 108
  • Karma: +0/-0
    • View Profile
Re: Flixel Power Tools
« Reply #26 on: Tue, Jun 21, 2011 »
Ah, alright. Thanks for clearing that up for me. I'm getting tired :) This is the second FTP class I use with this project, and I think I'll use *at least* one more before I'm done. Loving it :-*
My online portfolio // www.tomii.se
My twitter

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flixel Power Tools
« Reply #27 on: Tue, Jun 21, 2011 »
:) feedback makes 'em get better 'n better! Simple as that.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

foosety

  • Member
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: Flixel Power Tools
« Reply #28 on: Wed, Jun 22, 2011 »
Ok so I tried scaling the buttonNormal and buttonHighlight but ran into problems... First of the the picture did scale correctly and everything, however the bounding box was not affected by the scaling! The only thing I could think of was manually setting the width and height of each button's bounding box, which sort of worked, but my bounding boxes were off the screen while the image of the buttons were not. All in all I wish I could change the sprite before putting it into loadgraphic, but it doesn't work that way. Can you please help me?

Edit: Nevermind, I just scaled the sprites before hand instead of scaling them ingame....
« Last Edit: Mon, Jun 27, 2011 by foosety »

foosety

  • Member
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: Flixel Power Tools
« Reply #29 on: Wed, Jun 29, 2011 »
Hello again :)

So lately I've been using FlxScreenGrab which is super awesome. I just wish that it would save the file as a PNG. As of right it just saves it as grab(####) without an extension. Can you look into this?

Thanks man.

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flixel Power Tools
« Reply #30 on: Wed, Jun 29, 2011 »
It adds .png to the filename automatically - it even checks to see if you missed it out from the filename passed to it, and adds it if you did.

Look at lines 148-155 of FlxScreenGrab.as
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

foosety

  • Member
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: Flixel Power Tools
« Reply #31 on: Wed, Jun 29, 2011 »
I saw that... But this is all I get:



Here is the code I am using:
Code: [Select]
private function onPicture():void
{
FlxScreenGrab.defineCaptureRegion(Registry._body.x + 20, Registry._body.y + 20, Registry._body.width, Registry._body.height);
FlxScreenGrab.grab(null, true, false);
}

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flixel Power Tools
« Reply #32 on: Wed, Jun 29, 2011 »
That's just Windows (well, the way Flash Player uses it) being crap. Save the file, then right-click it, Properties, and click on the Details tab. I bet under "File - Name" it says grab13113.png

Windows just hides extensions by default, by it's there.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

felipe

  • Member
  • **
  • Posts: 36
  • Karma: +0/-0
  • games!
    • View Profile
    • i love pixel
Re: Flixel Power Tools
« Reply #33 on: Wed, Jun 29, 2011 »
I have a question about FlxWeapon. How can i detect the overlapping of a bullet with another object?
thanks!

//EDIT: Nevermind I just read the FlxWeapon class and it was written there..
« Last Edit: Wed, Jun 29, 2011 by felipe »

foosety

  • Member
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: Flixel Power Tools
« Reply #34 on: Thu, Jun 30, 2011 »
Oh yeah, you are right. The extension is just hidden.

That's just Windows (well, the way Flash Player uses it) being crap. Save the file, then right-click it, Properties, and click on the Details tab. I bet under "File - Name" it says grab13113.png

Windows just hides extensions by default, by it's there.

zuperxtreme

  • Contributor
  • ****
  • Posts: 254
  • Karma: +0/-0
    • View Profile
    • Buddah
Re: Flixel Power Tools
« Reply #35 on: Mon, Jul 4, 2011 »
Probably doesn't belong here, but how would I calculate the trajectory of a moving object?

I mean so that my FlxWeapon fires and always hits it's constant-speed target.
..."without order nothing exists, without chaos nothing evolves"... 
Zoklet.net

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flixel Power Tools
« Reply #36 on: Tue, Jul 5, 2011 »
If the object is moving at a constant speed then it's relatively painless to calculate (I'll post an example later if you need) - but if the object has acceleration or changes direction, it becomes a lot harder. For that you'd really need to have a "homing missile" type bullet - which I do have planned for the next update.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

zuperxtreme

  • Contributor
  • ****
  • Posts: 254
  • Karma: +0/-0
    • View Profile
    • Buddah
Re: Flixel Power Tools
« Reply #37 on: Tue, Jul 5, 2011 »
I'll see if I can come up with something, if not, I'll post here. :)
..."without order nothing exists, without chaos nothing evolves"... 
Zoklet.net

felipe

  • Member
  • **
  • Posts: 36
  • Karma: +0/-0
  • games!
    • View Profile
    • i love pixel
Re: Flixel Power Tools
« Reply #38 on: Mon, Jul 11, 2011 »
Is there a way that the members from one flxgroup follow the members of other flxgroup?

initials

  • Contributor
  • ****
  • Posts: 378
  • Karma: +0/-0
  • Initials
    • View Profile
    • Initials Blog. Code and other things.
Re: Flixel Power Tools
« Reply #39 on: Tue, Jul 12, 2011 »
I installed Power Tools last night and it was easy and painless. Great idea and implementation to have a plugins directory.

Good work everyone involved!
Initials: Super Lemonade Factory, Super Lemonade Factory Part Two, Above The Clouds, Revvolvver, Four Chambers of the Human Heart