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 - wg/funstorm

Pages: [1] 2 3 ... 30
1
help / Re: Q: FlxGroup iteration
« on: Sun, Oct 13, 2013 »
There's a couple examples of this being done in the code of FlxGroup.as

For example the setAll or callAll functions iterate through a group and all its subgroups

Code: [Select]
public function setAll(VariableName:String,Value:Object,Recurse:Boolean=true):void
{
var basic:FlxBasic;
var i:uint = 0;
while(i < length)
{
basic = members[i++] as FlxBasic;
if(basic != null)
{
if(Recurse && (basic is FlxGroup))
(basic as FlxGroup).setAll(VariableName,Value,Recurse);
else
basic[VariableName] = Value;
}
}
}

2
Try (Sprite1 as Bullet).bulletPC();

3
Have you waited at least 24 hours? It takes a while for them to update.

Regarding #2, you have to go to your dashboard -> add widget -> standard table -> display the following columns: hostname (green) visits (blue) new visits (blue)
You can also find the same info by digging through the options in the standard reports column on the left, but it's kinda hidden and I think the info is important enough that I turn it into a widget so I always see it right away.

4
help / Re: [Help Needed] Preloader not working :(
« on: Sat, May 4, 2013 »
If you try to use the Splatter class, it first needs to get loaded before it can be used. So, anything you put in your preloader will have to get loaded before the preloader displays. And in order for something to get loaded, it will also need to load all the things it references. Eg if splatter has a reference to playstate, it will also need to load playstate to load splatter. My guess is that your splatter class contains references to other parts of your game.

5
Ehm are you maybe just missing the ()?

Registry.LEVEL = new Registry.LEVEL_ARR[name]();

6
help / Re: Flixel and RPG's
« on: Thu, Apr 25, 2013 »
That 'magical function' is loadMap. The way you have your spritesheet set up right now 0=grass & 1=water.

      /**
       * Load the tilemap with string data and a tile graphic.
       *
       * @param   MapData         A string of comma and line-return delineated indices indicating what order the tiles should go in.
       * @param   TileGraphic      All the tiles you want to use, arranged in a strip corresponding to the numbers in MapData.
       * @param   TileWidth      The width of your tiles (e.g. 8 ) - defaults to height of the tile graphic if unspecified.
       * @param   TileHeight      The height of your tiles (e.g. 8 ) - defaults to width if unspecified.
       * @param   AutoTile      Whether to load the map using an automatic tile placement algorithm.  Setting this to either AUTO or ALT will override any values you put for StartingIndex, DrawIndex, or CollideIndex.
       * @param   StartingIndex   Used to sort of insert empty tiles in front of the provided graphic.  Default is 0, usually safest ot leave it at that.  Ignored if AutoTile is set.
       * @param   DrawIndex      Initializes all tile objects equal to and after this index as visible. Default value is 1.  Ignored if AutoTile is set.
       * @param   CollideIndex   Initializes all tile objects equal to and after this index as allowCollisions = ANY.  Default value is 1.  Ignored if AutoTile is set.  Can override and customize per-tile-type collision behavior using <code>setTileProperties()</code>.   
       *
       * @return   A pointer this instance of FlxTilemap, for chaining as usual :)
       */
      public function loadMap(MapData:String, TileGraphic:Class, TileWidth:uint=0, TileHeight:uint=0, AutoTile:uint=OFF, StartingIndex:uint=0, DrawIndex:uint=1, CollideIndex:uint=1):FlxTilemap

7
help / Re: Flixel and RPG's
« on: Wed, Apr 24, 2013 »
setTileProperties changes teh tile type's collision.

I think you're thinking of setTile(tileX,tileY,tileType) which is used to change a tile's graphics.

Check out the tilemap demo here, it has source code with lots of comments that explain how to load/display/change tilemaps http://flixel.org/features.html#tilemaps

8
Try using overlap. It does the same thing as collide, but without calling separate. Then when you're done doing what you want with the overlapping objects, you can call separate either manually or using collide.

9
help / Re: Correct usage of states
« on: Sat, Apr 20, 2013 »
Maybe not a 'correct' way, but definitely an 'intended' way as described by Gama and can be seen in the demo projects created by the flixel creator. Of course you don't have to use them that way, but you then you will
a) lose certain benefits that are built into the intended method (eg releasing memory used up by the flixel cache)
b) have to come up with your own system

So if you're auri, and you totally know what you're doing, then do whatever you want, but if you're just starting out it will be a lot easier to use them in their intended way.

10
Hmm strange, checking for shift && a key should work.

P.s. I've heard the use of shift generally discouraged for flash games. If you press it a couple times on Windows, it pops up an annoying 'do you want to use sticky keys?' popup. I know at least 1 site that requires you to remove shift key bindings in games they buy.

11
If you're event curious what the flixel key constant is, just open up org\flixel\system\input\Keyboad.as and you'll see the list.

12
help / Re: jerky sprite movement? (very new, sorry)
« on: Sat, Apr 6, 2013 »
Velocity is already independant of framerate. An object with velocity of 150 will move 150 pixels per second, regardless of framerate. If you look at FlxObject.updateMotion code you will see it already uses FlxG.elapsed.

Code: [Select]
delta = velocity.x*FlxG.elapsed;
velocity.x += velocityDelta;
x += delta;

So you don't need to apply it a second time. Applying FlxG.elapsed yourself is useful when not using velocity. Eg if you do object.x += 50; then that's not independant of framerate and you could multiply it by elapsed to make it independant.

Anyways, to try and answer the original question, I'm not sure exactly what's going wrong. You could try applying this suggestion http://forums.flixel.org/index.php/topic,5072.msg29379.html
And if that doesn't help, you could set some break-points or traces in FlxObject.updateMotion to really dig deep and understand exactly why the values generated are inconsistent.

13
When you use remove like that, it's not actually being removed from the members array, it's just getting set to null. To remove it from the members array completely, use the Splice:Boolean parameter of the remove function eg items.remove(targetObject, true);

However a better overall approach if you're frequently spawning and removing objects is to recycle them so that you don't have to use & destroy memory all the time. To get a recycled object use:
myItem = items.recycle(ItemClass) as ItemClass;
myItem.reset(itemX,itemY);
// set any other values on the item that you need to when it spawns

Then when you're done with it just
for each (var item:ItemClass in items.members)
{
     if (item.alive && item.y > FlxG.height)
    {
        item.kill();
    }
}

That's just the very basics of recycling, if you do a forum search for it, it will turn up loads of threads with a deeper explanation.

14
help / Re: Playing an embedded SWF
« on: Wed, Apr 3, 2013 »
So I just added this exact same branding swf today as well and ran into the same problem :P Instead of using the loader, I just called sponsorMc.stop().

15
help / Re: Kill() not working on FlxText
« on: Wed, Apr 3, 2013 »
I'm guessing the actual source of your problem may be a transparent background. If your background color is set to transparent, flixel doesn't automatically clean it every frame so things appear to be overwriting each other.

If you don't need a transparent background, just add FlxG.bgColor = 0xff000000; to your create function.
If you do need a transparent background, you will need to override update and add FlxG.camera.fill(0x0, false); to it.

If that doesn't help, upload your project somewhere and I'll take a look.

16
help / Re: Very strange custom camera behavior
« on: Wed, Apr 3, 2013 »
Can you show the code where you define the camera variable from 'camera = new SmoothCamera(player);' and anything related to it.

17
help / Re: FlxBar disappearing
« on: Sat, Mar 30, 2013 »
To change the color of the bar, use flxbar.createFilledBar():

Code: [Select]
/**
* Creates a solid-colour filled health bar in the given colours, with optional 1px thick border.
* All colour values are in 0xAARRGGBB format, so if you want a slightly transparent health bar give it lower AA values.
*
* @param empty The color of the bar when empty in 0xAARRGGBB format (the background colour)
* @param fill The color of the bar when full in 0xAARRGGBB format (the foreground colour)
* @param showBorder Should the bar be outlined with a 1px solid border?
* @param border The border colour in 0xAARRGGBB format
*/
public function createFilledBar(empty:uint, fill:uint, showBorder:Boolean = false, border:uint = 0xffffffff):void

18
help / Re: Playing an embedded SWF
« on: Fri, Mar 29, 2013 »
I've had issues with this in the past as well...

One time the main swf only had 1 frame, and the entire actual sponsor logo animation was inside 1 movieclip on the stage, so I had to check against the frames of that movieclip. To get the correct mc I did:
Code: [Select]
_sponsorLogoMc = ((_sponsorLogo.content as MovieClip).getChildAt(1) as MovieClip); // the 1 in getChildAt will vary depending on which child the movielcip you want is
And then in update:
Code: [Select]
if (_sponsorLogoMc.currentFrame == _sponsorLogoMc.totalFrames)

Another time, I can't remember what issue exactly I was having but in the end I just said screw it and manually entered the total number of frames to check against.
Code: [Select]
private const SPONSOR_LOGO_FRAMES:uint = 180;
_sponsorLogo.addEventListener(Event.EXIT_FRAME, frameComplete);
logoFramesRemaining  = SPONSOR_LOGO_FRAMES:uint ;
And then in frameComplete:
Code: [Select]
logoFramesRemaining--;
if (logoFramesRemaining <= 0)
{
_sponsorLogo.removeEventListener(Event.EXIT_FRAME, frameComplete);
FlxG.switchState(new State_Menu_Main());
}

Anyways, hope one of those methods helps you.

19
help / Re: How does destroy() work?
« on: Fri, Mar 29, 2013 »
As long as any piece of your code is storing a reference to your object, flash can't free up that memory because it has to assume it's still being used. By setting it to null, you are removing that reference.

20
help / Re: FlxBar disappearing
« on: Fri, Mar 29, 2013 »
When you set the x & y of the bar, that's only setting the x & y where it spawns. Then it will get repositioned according to the parent it is tracking. So I think both of those bars should appear in teh correct place, but then immediately get repositioned to appear on top of each other on the next frame. Which could explain why it appears in the right place and then disappears. The weird thing is that you're seeing the health bar... since you're adding the power bar last it's the one which should get drawn on top.

Anyways, I'm not 100% sure what the issue is but maybe that helps point you in the right direction? If you want to offset where a bar appears relative to its parent use myBar.positionOffset. There's no restriction on the number of flxbars or anything like that.

Pages: [1] 2 3 ... 30