18

I use the following method which is pretty much just an implementation of this algorithm. It's in C# but translating it to ActionScript should be trivial. bool IsIntersecting(Point a, Point b, Point c, Point d) { float denominator = ((b.X - a.X) * (d.Y - c.Y)) - ((b.Y - a.Y) * (d.X - c.X)); float numerator1 = ((a.Y - c.Y) * (d.X - c.X)) - ((a.X - c....


13

Flash garbage collector doesn't work very well, nor its destructors do a good job of actually destroying things either. Even if your code is correct and shouldn't leak, Flash might mess it anyway. Try to allocate the bare minimum of things you actually need, and instead of destorying and recreating them, just recycle them.


12

Find an engine that runs on all three platforms (i.e., is cross-/multi-platform) and meets your requirements. The latter will vary with time and only you know all the requirements you need, so finding the correct engine is left up to you.


11

At our studio we are working with Haxe and NME, and the advantages are great. Performance and cross-platform are the more important points (at least for us). Pros Even with only a few people in the forums, you can receive a lot of help. It's a very active community. Check at haxenme.org, haxe.org, and haxe group in Google groups. Numerous people ...


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 ...


9

There are 360 degrees (2π radians) in a circle. Divide that by the number of objects, and that tells you the correct angle between the objects, for even spacing. If you want to keep the objects the same distance apart no matter how many objects are in the circle, we need to calculate the distance out from the center at which points are that distance apart. ...


9

Here is my complete learning experience, resulting in a pretty much functional version of the movement I wanted, all using Nape's internal methods. All of this code is within my Spider class, pulling some properties from its parent, a Level class. Most of the other classes and methods are part of the Nape package. Here's the pertinent part of my import list:...


8

Flash is dying. Whatever some Flashers may tell you, HTML5 is slowly taking its place. Slowly, because HTML5 still isn't really production ready in many senses, for full-fledged and straightforward game dev. You can see solid stats for the shift over the last year if you look (for example) at those jobseeking sites that record these things, Flash demand is ...


8

How about making any "stick" surface a character touches apply a force along the inverse normal of the surface? The force remains as long as they're in contact with the surface and overrides gravity as long as it's active. So jumping off the ceiling will have the expected effect of dropping down to the floor. You would probably want to implement some ...


6

Whenever you do a float operation, some rounding errors are bound to occur. Because you are adding each specific layer's position change on every frame, eventually these errors add up and become noticeable. Say you have a max error e in each multiply operation, then with your algorithm the frame 1 position is: layer1.x(1) += cameraTarget.moveX * layer1....


6

Gals Panic, is a Qix type game. You may search for Qix to get more information on how things work. The general concept here is, having two images. One is the picture that you want to be revealed. The 2nd one is the actual gamefield where the game is checked against. These two are combined to produce the end result. So suppose the filled game area is white ...


5

It depends what you mean by "MMO" it would be quite possible to build an MMO client in Flash. The real question becomes what does your server side software look like? How real-time is this game going to be? Are you talking an MMO like World of Warcraft or something similar to a text-based-turn-based game like Kings of Chaos? IMHO, you could make a very ...


5

The second idea would be much, much faster. Rendering dozens of DisplayObjects every frame is going to be slower than occasionally re-blitting to a Bitmap. Depending on the speed/memory tradeoff you want to make, you can make the background Bitmap wider to make your redraws less frequent. Keep in mind that there is a maximum size for Bitmaps, depending on ...


5

If you implement the rules from Tic-tac-toe Wiki you can create the perfect AI that always wins, then you can decrease the difficulty by making the AI do random moves, and the frequency of random moves is the difficulty level. Here are the rules: Win: If the player has two in a row, play the third to get three in a row. Block: If the [opponent] has two in a ...


5

Z-sorting or depth-sorting in as3isolib is calculated (by default) in the following class: public class DefaultSceneLayoutRenderer implements ISceneLayoutRenderer that can be found in: package as3isolib.display.renderers The code inside DefaultSceneLayoutRenderer itself is actually not too long (only 200 hundred lines of code w/comments and all) but ...


5

While Flash is still a thriving and vibrant platform to develop on, I would ditch it in favour of Unity, simply considering the unavailability of Flash on some mobile platforms that you may want to port to later. There is a free package available in the Unity marketplace called Orthello, which greatly simplifies the process of making 2d games with Unity. ...


5

As a subquestion, I'm also assuming here that the best way to store data that will be bundled with the final game and not read externally is simply to declare everything in AS3. Seems to me that if I used, say, XML or JSON I'd have to use the associated AS3 classes and methods to pull in the data, parse it, and convert it to AS3 object(s) anyway, so it would ...


5

I guess you're referring to the default entries in the Flash-Player menu: The entries there can be customize (to a certain degree) by using the ContextMenu class. Here's an example. In a frame of your timeline (preferrably at the beginning), place the following code: var menu:ContextMenu = new ContextMenu(); var items:ContextMenuBuiltInItems = new ...


5

(1) You may be able to adapt an algorithm used for creating word clouds. Here's one example algorithm, based on Wordle's strategy. This works by choosing a start position/size/orientation for each object (generally starting with the biggest/most important ones), and trying to place it there. If it collides with an already-placed object, move it ...


5

Here's what I normally do with my states. It might not be the best way, or even the second best (but remember, the thing that matters is not the architecture of your game code, but the actual end result.). I start with a basic State-class (all code in Pseudo-C++): class State { virtual void Event(Event e); virtual void Update(float deltaTime); ...


4

The simplest way would be to make your paddles origin at the center of the circle. Then you just need to calculate the angle and you're done (your paddle origin, or center position should be at the circle center and the paddle itself should be to the right of the circle as starting position). Something like this: // calculate delta from circle center to ...


4

You can't establish a direct connection between two flash-applications. You could write a server (for example in JAVA) which both flash clients connect to by using XMLSocket. You can also do all your coding in Actionscript, but for that at least one of your applications needs to be an AIR application. There you can use ServerSocket and use Socket to connect ...


4

A naive approach would be to simply perform a brute-force check on all pixels. As soon as you hit a non-transparent pixel you can stop searching further. This won't work very well with large images and can result in quite extensive searches if the last non-transparent pixels are at the end of the search. There are two better ways I can think of: Similar to ...


4

I managed to fix it with a profiler (the miner). I had b2vec2 and sprite leaks. GC won't gather if you keep references to objects so just make sure you have a destructor in your custom classes, delete and null everything you can. Most of all if you use big libraries such as box2d make sure you null even local vars. With bitmap data use bmpdat.dispose(); and ...


4

Without Divisions! So no problem with precision nor by division by zero. Line segment 1 is A to B Line segment 2 is C to D A line is a never ending line, the line segment is a defined part of that line. Check if the two bounding boxes intersect : if no intersection -> No Cross! (calculation done, return false) Check if line seg 1 straddles line seg 2 ...


4

The A* heuristic is an estimate. It usually does not give you the true distance. You can calculate distances exactly on a hexagonal grid. See section 4 of Clark Verbrugge's hex grid guide, and then section 2. Alternatively, see aaz's answer on this stackoverflow post.


4

In case of the zeroes and ones, you have to split with "", but in case of the tile-numbers this doesn't work as it would create an array entry for - and 1 when the value should be -1. But luckily you have a delimiter , which you can use. So instead of levelTiles = levelTiles.split("\n").join(""); levelTiles = levelTiles.split(",").join(""); tileArray = ...


4

Either 2 of these it think: - It would very well be that you are deleting stuff from the display-list but still have references in other places( like arrays ) that are still being processed. This keeps building up and completely hogs your game. ( but Flash can easily handle tons of objects ) or -Your algorithm, even though simplistic, is flawed and is ...


4

"I want to see where my movieclip colliedes with another another movieclip." Actionscript offers pixel perfect collision detection between bitmapData objects. It does not offer straight out of the box a tool to detect the exact points where the two objects overlap. How to detect where two objects are 'touching' on another? Create two bitmapData objects ...


4

You're not working with bitmaps here. The graphics object you're using uses vector graphics. So basically you're painting a lot of rectangles to your mask... The only reasonable way to determine whether or not your mask is entirely filled would be to render it to a BitmapData (using BitmapData.draw) and then iterate through the pixels until you hit a ...


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