Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - GrimPanda

Pages: 1 [2] 3
help / Re: Some more newb issues :)
« on: Tue, Jul 12, 2011 »
For the text not showing up, you are adding the texts group,

Code: [Select]
texts = new FlxGroup();
And you are adding text to the group,

Code: [Select]
but you never added the actual group to the stage (in create()):

Code: [Select]

help / Best method to embed resources?
« on: Tue, Jul 12, 2011 »
I hope I can phrase this in a manner that makes sense.

I've always wondered which is better when you embed resources in flash/flixel.  Some sprites, like buttons or panel backgrounds I may use in multiple classes/states.  Yet, others will only be used in one class/state.

So my question is... is it better to A) Throw all the sprite/resource embeds in one class and just include it on each class.  B)  Embed each resource individually per class, even if I'm embedding the same resources multiple times throughout different classes.  C)  Make a Resource class for common embeds (fonts, buttons, etc) and individually embed resources unique to only one class.

I'm wondering if including a central Resource class is a memory waste if I don't need all the other embeds on it at that time?  I prefer the central location for organization, but if it's a memory waste, then I'll change my code.

Hope that makes sense. 

help / Re: Blend Mode on FlxTilemap?
« on: Tue, Jul 12, 2011 »
Which tutorial is this?  I have some ideas, but I'd like to see what they did before I say anything.

Oh and part 2 of my .net tutorial hits tomorrow :)

I thought it was coming in Sept?

help / Re: creating bullets
« on: Fri, Jul 8, 2011 »
Code: [Select]
super(x, y);

Should be:

Code: [Select]
super(X, Y);

That capitalization is very important.  x and y (lowercase) are the x and y coords of the *current* bullet, as they are inherited variables from the parent class FlxSprite.  But in the constructor to this class you passed X and Y (capitals), which is the position of the player when you create this bullet.  By passing the parent X,Y you assign x,y these values, (and other important things) which moves the bullet from we'll say (0,0) to maybe (120, 238) (or wherever your player is).

Now that is done, you need to make the bullet move.  Try adding velocity.x = 100;  after your play("BULLETanim");  line.    The bullet will now travel in the x axis in a positive direction.  (change the speed and direction as needed);   For example if the player is facing LEFT, fire it in  x -100;   if he's facing right 100; Use y for up and down if you need it.

As far as your update.  Just stick super.update() in there for now.  And you should be getting closer. 

As far as your inaccessible method error, that is because there is no method bullet in your Registry class.  (UPDATE: Figured out what the Registry bits are about.  I guess that's a good practice to start with!).   To fix this... try something like

Code: [Select]
var bullet:Bullet = new Bullet(Registry.player.x, Registry.player.y);

as Chelnok suggested.

releases / Re: FlxCaveGenerator
« on: Fri, Jul 8, 2011 »
Amazing!  Thanks for sharing. 

help / Re: FlxStatemachine
« on: Fri, Jul 8, 2011 »
Nice!  I'm going to look into this later.  I can't get enough states!  Thanks for sharing.

games / Re: AlienInvasion (working title)
« on: Fri, Jul 8, 2011 »
thanks guys. I am still working on the effects. Just seen Really Big Sky Video and now my game feels so small and ugly .

I bet somewhere, someplace, there is a post buried somewhere in the ruins of the interwebs, and within it the creators of BS, and RBS said the same thing about another game back then, when they released something in the beginning.

And someday, maybe not long from now, there will be another post of a developer saying the same thing about your game.

Ahh, the majestic beauty of gaming, so timeless haha ;o)  Grats man, this game looks great!  You have no worries.

help / Re: creating bullets
« on: Fri, Jul 8, 2011 »
Ah I see you are creating a new player instance in your bullet class.  Basically you are making a "new copy" of the player that isn't really the player you already have existing.  You want to get the x and y coords of the existing player, and then pass that to the bullet class.

public function Bullet(X: Number, Y: Number):void  (*or use X:int, Y:int, whatever you are currently using)

where X and Y is the current player.x, player.y  not a new player you created in the bullet class.

Code: [Select]
     if (FlxG.keys.Z)
     {add(Registry.bullet(player.x, player.y)}

Like so.

also in your Bullet constructor, make sure you call super and pass those values to the FlxSprite parent.   So add


to the first line of your constructor.

help / Re: Setting Button Width
« on: Fri, Jul 8, 2011 »
What I do is just make 2 or 3 button sizes using standard embedded graphics and then use whichever best fits the text, even if that means that sometimes I end up with a button that has a bit of extra space around the text.. no biggie.

This may just do the trick.  I'm using their Facebook first name, which can be from 2 to 30 characters long... (what a spread!), but that should give me a good range to work with for sizes.


help / Re: creating bullets
« on: Fri, Jul 8, 2011 »
x = Registry.player.x
            y = Registry.player.x

You have your y set to player.x

help / Re: Problem with colliding
« on: Fri, Jul 8, 2011 »
Well offhand without seeing the code, when you are jumping I'm assuming you are setting velocity.y to a postive value.  In your collision check with the ledge and the player, if there the player hits the bottom of it, you should set the velocity.y to a negative value so he falls down rapidly.  You also want to add a state check in the player class.  Something like _curState:string;  set that to "falling" when he falls, and then add that to your keypress check.  If w.pressed() && _curState != "FALLING". 

Pretty rough description, but I think you see where I'm going hopefully.

help / Re: Problem with colliding
« on: Fri, Jul 8, 2011 »
changed .pressed() which sees if it is held down to .justPressed() which only checks it once, then holding the key won't make him stick.

Nice!  Grats! and Thanks!

(I've never made a font myself, that's pretty cool )

Another thought... and this is mostly for people that really get heated over the 'secure my flash game' topic.  If you have protected yourself with what the industry considers a decent solution (such as Kindi's secureSWF or others), I think you have to ask yourself:

Is my code theft really something I need to lose sleep over?

Now immediately everyone wants to go crazy about how their scripted love child is the most sacred thing ever, but really 90% of the stuff we all put out is truthfully the same dog, same tricks, different yard.  Very rarely in a flash game does the code inside do something truly novel and worth "unbreakable" protection (that we will never have).  Sure we have some neat tricks here and there, and sure there things we WANT and should TRY to protect.  (and hopefully you didn't store anything in there thinking no one would ever see it, like server paths and backend login info, etc). And if you are using server connections (and probably puts your game much more into the '10%' worth stealing category), you are talking server security then, which is another topic altogether, and quite serious.

Again, assuming you've protected yourself to industry standards, and followed good standards in design, you've done what you can.  And if someone wants it bad enough, they'll have it.  But I ask again... if you step outside of your shoes, out of the "parent" role, and think about your software, do you really think that A) Someone is going to look at your app and say, "i need that source", or B) After working through to get a useable source that they will find some holy grail of magic code inside?  Probably not....

I say this all because sometimes you gotta pick your battles.  And like anyone else, I want my code protected, even if it's 'hello world'.  Why not? It's mine, not yours, and I'll open source it if I want you to read it.  But... this is a battle that we will NEVER win.  Ever.  Period.  Time has proven that a 15 year old kid can laugh in the face of a million dollar security budget over and over and over.   It's flash, and it's client side, and its easily retrieved.  Those are the breaks.  Make it hard, make it painful, and try to come to terms with the fact that chances are it's not going to get stolen anyways.

It was a lesson that took me awhile to learn.  But I'm the happier for it.

PS For those reading this that still are a little heated in the ears (and some of you know you are, stammering but... but... insert this point here)  Take any flash game on the market and ask yourself two things:  1)  Is it 100% safe?  2) Is there really something in there you would steal outright?? (or would you just learn from how they did things in general?)

If you can say yes to either AND you think that not only does this apply to more than just that game but more than the 10% I reserved above, then I'm off my rocker. :o)

(also this isn't about DRM, which is something you need to fight tooth and nail over if it's taken from you, and should worry about no matter what).  DRM can be violated regardless if they read our source or not. That's a different topic really.

help / Setting Button Width
« on: Fri, Jul 8, 2011 »
I've been away from Flixel for several releases, so perhaps this is just something that I just can't find in the docs.

I'm trying to create a button.  This button will get it's text from an external data source, and it's length will be unknown to me at run time.  It's basically a user name, and is formatted into the correct font, size, color etc as an FlxText object.  I then get the width of that string in pixels through a custom function.  Everything is great so far.

Now I need a button to place this FlxText on and set the width of that button to the width of the string in the FlxText object. (plus padding etc).  So I drop a new button down, set the label to my FlxText Object, and then theoritically, I would set the width of the button as needed.

Code: [Select]
_myBtn = new FlxButton(100, 100, '', goDoStuff);
_myBtn.label = _myTxt;
_myBtn.width = 200;  //_myTxt.pixelWidth

Line 3 above silently does nothing.  It actually get's it width from my function there, but I can put in a fixed width (so we can avoid 'your function isn't returning a valid value') and it still will not set the button width. 

FlxSprite.createGraphic() is gone (I'm using 2.55), and FlxButton.loadGraphic() is looking for a class object embed, which I don't want to use since the button is a variable width at runtime.  (although I would love to use a graphic for the button that can resize itself gracefully, but that seems a bit complicated.  I was thinking of doing something like a mid section that tiles a background, and then capping the ends with the 'end images', as you would do in CSS for example.  But this seems like a headache in as3).

I know setting a button width has got to be mindnumbingly easy, but somehow I'm hitting a wall here.  Any idea how to accomplish this easily, or why FlxButton.width isn't doing anything in my code?

Thanks a ton.

chat / Re: Improving Flixel's collision checks?
« on: Thu, Jul 7, 2011 »
I think that page is referencing more of a game wide philosophy than an 'engine wide' one.  I think there are always some immediate conditional checking a game can do to eliminate needless collision checking before sending it out to the actual expensive checks.  These conditionals or marginal checks really need to be setup in individual games and even different areas within the same game as conditions change.

chat / Re: Forum Upgrade
« on: Thu, Jul 7, 2011 »
When searching on the forums, if I type a phrase/keyword in the search box at the top of the page, I am sent to a search page that shows no results.  Simply clicking the "refine search" button again (without changing anything), will yield the correct results.  I'm not sure if it's just me with this issue, but if it's system wide, that might be something to look into.

chat / Re: User generated content in flash games
« on: Thu, Jul 7, 2011 »
Playtomic in my understanding is currently free for most non social flash games (such as online games, mmorpgs, etc).  However this could change.  They have really grown quite a bit lately in size, and that comes with a bandwidth cost... so yeah.   *REF(

I'd try it if you can.  We use them for our games and are very very happy with it. If not, I would do as suggested above, stick with a LAMP stack server back end, and use JSON or XML data for pass through.  That format will allow you to port that data pretty much anywhere you need to go if you make any shifts down the line, want to add data mining/reporting or anything else.


EDIT: Forgot pricing link

chat / Re: Forum Help
« on: Thu, Jul 7, 2011 »
As the forum layout has changed since the original post and my replies, I'd like to see if this is cleared up.  I spoke with my friend, and they have not had the problem since the new forum, but time will tell I guess.

Pages: 1 [2] 3