Hot answers tagged

9

As I said in the comments, a 2D array would probably help you out. Lets say this is our 5 by 5 grid and we have a match So we know 3 tiles will be removed, therefore we need to randomize 3 new values for 3 spots. The catch is however we first need to move the tiles in the same column that were above( blue ) the tiles that were removed (red). It would be ...


3

When you set level to a new value, you lose the reference to it in your code. Its parent FlxGroup still maintains a reference to it in its members array, however, so it continues to display. Using remove is a good idea, but I suspect you're doing it like this: level = new FlxTilemap(); level.loadMap(FlxTilemap.arrayToCSV(data2,40),FlxTilemap.ImgAuto,0,0,...


3

Using Flash's built inTimer isn't a great idea in Flixel. You should really use the Update function in conjunction with FlxG.elapsed, as this will respect pausing and resuming the game using Flixel. Here's an overview of how to use Flixel's timing: http://flashgamedojo.com/wiki/index.php?title=Timer_(Flixel)


2

You don't set the world size with: public function MyGame() { super(320,720,PlayState,2); } That is setting the size of the screen Flixel will draw onto. If you want a zoom level of 2 you should have super(320, 240, PlayState, 2). You should check out the source for Mode to see how to create a world larger than the screen. What happens in Mode is that ...


2

Found it. It was the semicolon (;) after the [SWF(...)] that killed it. Got it rocking now :) I believe the FLEX compiler is to blame here, since tutorials also have this semicolon, they'll probably used the Flash IDE...


2

Not sure what went wrong there. Just tested that setAll("visible", false) call on a FlxGroup and it seemed to be working fine. A few other things though: You should not need to do a setAll() for visibility on a FlxGroup at all. FlxGroups have a visible property themselves, because they extend FlxBasic! The button you're trying to implement, having a sprite ...


2

The choice of development technology is something you have to decide based on your goals. If you have never written a game before, then the last thing you need to worry about is any sort of middleware limitations, what you need is experience under your belt. Either way, the technology choice should be made based on the skillset of the development team, the ...


2

Hi Matthew and thank you for your question. Since ActionsScript uses garbage collection there are only 2 reasons. First you have references to these objects in your own objects or from a manager in fixel. In this case be aware to null your references. Maybe the tool mentioned here could be useful. Second your garbage collection did not trigger ...


2

If you want to add a screen before all assets are loaded you have to use a preloader. You can read about this here. Flixel provides simple preloader (FlxPreloader) that is easy to understand and to customize.


2

So, while there might be several ways to do it, I've found it easiest to make a seperate State for each of my game 'sections' - so, the Main Menu, the Game Itself, and the Game Over/Scoreboard screens would each be their own state: MenuState, PlayState, and EndState, respectively. So, make a new Class: MenuState.as and make sure it extends FlxState. In the ...


2

openfl.Assets.getText("assets/dialogs/exampleDialog.txt"); should do the trick.


2

Simple, you're calling bat.play("batAnimation",true); in your update loop. That means, your animation will restart every frame, resulting in a still image. The second parameter to the play function is a flag whether or not the animation should be forced to restart (see docs). So either call: bat.play("batAnimation", false); in your update loop, or what I ...


1

There is this haxe ui builder you might want to check out. In general however, if such a tool doesn't exist or doesn't give you what you want, what might help is to create the UI using an image editing program (like Flash/Animate or Photoshop). You can edit and fine tune it until you are happy with it, and when you are done write the code manually. This way ...


1

For now I have solved it in the following manner in the PlayState class I added a function to move objects and an array to track what objects are currently moving class PlayState extends FlxState { public var TILE_WIDTH:Int = 16; public var TILE_HEIGHT:Int = 16; // since flixel pathfinding does not have an onComplete callback, lets add it ...


1

Gama11's method is the one I would use personally. Basically you put all of your text inside a text file dialog.txt and split each dialog up with some special character or character sequence (i.e. @@). ------ dialog.txt ------ This is dialog for box 1.@@ Dialog for box 2.@@ And so on...@@ inside of your game use the following: var dilog_boxes:Array<...


1

My guess would be it's a floating point precision difference (do the two environments use different runtimes/sandboxes? I'm not very familiar with flash). It looks like yPos is always turning out fine. My suspicion is that it has something to do with "(yPos % 2)", try yPos as a float instead of an int. A little hack that could fix it if that doesn't work ...


1

I've found it helps to set all references for objects to null on destroy.


1

So what i did to fix this is, i made 10 variabiles in advance and made the code check if there are any dead ones first, and then just revive the dead one. Recycling 10 objects forever fixed the leak


1

You could create a Sprite subclass that features a pivot point and uses transformation matrix to update position, scaling and rotation. A nice example with source code can be found here : http://jamesvango.co.uk/blog/?p=136 Another lazy way to get around, is adding your sprite in a container sprite, then move it so it's center is alligned with the parent's ...


1

I looked at what I think is the AS3Math lib you're talking about. Here is their amCircle2d class. It doesn't look terribly useful, since it inherits from (amCurve2d)[https://code.google.com/p/as3math/source/browse/trunk/src/As3Math/geo2d/amCurve2d.as] but doesn't implement getPointAtDist, which, if you fed it a distance a long the circumference of the ...


1

Your signature for SetDirection() is incorrect. It should be SetDirection(e:TimerEvent). Flash can be forgiving about this sort of thing resulting in some infuriatingly subtle errors.


1

You can successfully compile a Flixel project on Ubuntu by downloading the Flex SDK, adding it to your PATH, and running mxmlc YourMainGameFile.as -static-link-runtime-shared-libraries=true OR Install Eclipse 3.7 Indigo, FDT 5 (http://marketplace.eclipse.org/content/fdt-1#.UPolm32Ux0w), and the Flex SDK mentioned above. Make a new Flash Web project and ...


1

You might need to mark the buffer as "dirty". Looks like you can do this via setDirty(). These threads touch on "dirty" a bit: stamp() doesn't work with blend? FlxSprite.pixels vs. FlxSprite.framePixels (2.55) odd behavior?. My understanding is that Flixel has some optimizations that pre-compute values for drawing and it will only recompute them when the ...


1

You can have one (or a few) PNG sprite sheet and use it for multiple different sprites. You'll need to create the sprite object and use loadGraphic(graphic,true) to load the sprite sheet. "animated" must be true; if it's false the entire image will be one static frame. "graphic" is the embedded PNG of type Class You'll have to put them all in one horizontal ...


Only top voted, non community-wiki answers of a minimum length are eligible