Recent posts by player_03 on Kongregate

Flag Post

Topic: Game Programming / What do you use to make a particle engine in openfl

If you’re only targeting Flash, you could use Starling. Starling uses the GPU to render lots of objects quickly, and it supports alpha, rotation, scaling, and more. Here’s how to get started:

1) Download the latest version of Starling.
2) Move the precompiled .swc file into your project. (It’s under starling/bin/ in the zip you downloaded.)
3) Add the following to project.xml: <haxeflag name="-swf-lib" value="path/to/starling.swc" />.
4) Add this patch file to your project.
5) Add the following to project.xml: <haxeflag name="--macro" value="patchTypes('starling.patch') />.
6) You should now be able to access all of Starling’s features, but be warned that autocompletion will be almost nonexistant. You’ll have to rely heavily on the documentation instead.

For better autocompletion, run the following from the command line:

haxe -swf-lib starling.swc --gen-hx-classes --no-output -swf temp.swf --macro patchTypes('starling.patch')

It won’t actually generate the temp.swf file, but it will generate a bunch of “stub” classes, located in the hxclasses folder. Copy the starling subfolder into your project’s source directory, and delete the rest.


Oh, and it looks like HaxeFlixel supports particles. It might be easiest just to use that.

 
Flag Post

Topic: Bloons Monkey City / DDTs on a budget

Engineers are arguably the best source of early-game income. Farms obviously win out in the long run (even ignoring Research Facilities), but Engineers pop bloons while they’re at it.

You can normally get the upgrade by round 10 or 11, and it pays for itself in ~12 uses of the ability (you’d think it was six, because it gives ~500 gold each time, but keep in mind that you’d have gotten half of that from popping the bloons normally). If you take into account that you’re going to sell it, anything past 3 activations is profit.

 
Flag Post

Topic: Bloons Monkey City / DDTs on a budget

Have you tried building up money with a 4/0 Engineer? With enough money, you could get a 0/4 Ace, whose ability instantly pops all DDTs (but doesn’t deal damage to anything inside). Then I guess you could sell it and buy something else to clean up the other bloons.

 
Flag Post

Topic: Idling to Rule the Gods / Move to android/ios?

Originally posted by ArmoredThirteen:

I suspect the developer uses multiplication and/or division somewhere in this game. That’s surprisingly expensive for a computer to do.

False. Multiplication takes approximately the same amount of time as addition or subtraction. Division takes longer, but for floats/doubles, it should still take less than a function call.

 
Flag Post

Topic: Bloons Monkey City / How to handle rushes ?

I’m surprised no one mentioned Ring of Fire yet. It’s cheap for a 4th-tier upgrade, and it wipes out massive numbers of bloons if you place it right. It can pop anything except camo, so use it to clear out the zebra and black bloons, and your bombs will be that much more effective.

Also, the Engineer is a better starting tower than the Wizard. A 1/0 Engineer will handle the first wave or two, leaving money open for an early Banana Farm. I never survive using a Wizard unless I forgo the Banana Farm.

 
Flag Post

Topic: Kongregate / [New Feature] Introducing Kongpanions!

Originally posted by Holy2334:

I have a feeling that you guys will get what you want but its gonna be in a cute cuddly form.

http://ursulav.deviantart.com/gallery/7872436/Happy-Cthulhu-and-Friends

 
Flag Post

Topic: Game Programming / AS3 - Ensuring Shared Objects still exist

Clearing history doesn’t, but clearing cookies does.

Flash save files are considered cookies because some sites use them that way.

 
Flag Post

Topic: Bloons Monkey City / Useful Info about BMC

soul4hdwn already settled this.

The Ring of Fire’s blast stays the same size regardless of the second upgrade path. However, the tower will not shoot unless it can see a bloon, and it can see farther with the x/1 and x/2 upgrades.

In Uesugi’s example, the 4/0 tower could pop all the bloons around it. However, it can’t see them, so it doesn’t try. The 4/2 tower can see them, so it attacks.

 
Flag Post

Topic: Game Programming / {AS3} Partial Blitting

You could fall back to using draw() for the player, rather than copyPixels(). Adding a single extra draw() call per frame isn’t going to slow it down very much.

Or you could switch to GPU rendering. The GPU is a lot better at sub-pixel rendering.


Ctrl+W is not just a Flash keyboard shortcut. It’s supported by many different programs, including Firefox and Chrome. My advice is to stay away from the ctrl key.

 
Flag Post

Topic: Game Programming / {AS3} Partial Blitting

Originally posted by Kainevg:

For me personally I found it best, I was just wondering if their was a better method.

Well, you do want to merge as many layers as possible… How about something like this?

1) Render the missiles to a bitmap.
2) Hittest.
3) Keep the bitmap around for later.
4) In the rendering phase, draw everything behind the missiles to your main bitmap.
5) Use copyPixels() to copy the missiles to your main bitmap.
6) Draw everything in front of the missiles.

This cuts it down to two large bitmaps, only one of which is displayed onscreen. It’s an extra call to copyPixels(), but it uses less memory, so it’s probably better.

Originally posted by Kainevg:

For example, if I want to blit a moving object using copyPixels() by say 0.2 pixels per frame, this results in stuttered movement, as I presume copyPixels() is copying to whole pixels, not allowing for partial pixel movement to occur, what do you think is the best way around this?

You could draw a “half pixel” frame and display that when the object is between pixels. Actually, you’d probably need four frames: the original, +0.5 x, + 0.5 y, and +0.5 in both directions. This would work whether or not the source was a vector image, but it would look better with the vector.

Alternatively, you could fake it. Blit two copies, one pixel apart from one another. If the object is halfway between pixels, both copies should be at 50% alpha. If it’s closer to one side, that copy should be more opaque. (Or would that cause it to fade in and out? Maybe the “closer” copy should be at full opacity and the other should fade in/out.)

To accomplish the fading, pre-render a set of bitmaps to use as the alpha channel. Fill each one with a solid color, with a slightly greater alpha than the last.

Originally posted by Samoht777:

Wait, you’re saying to pixelperfect hit test with layer1 and layer2? Wouldn’t you then have to backcheck the position of the hit detection to determine which objects were actually colliding?

Only if it matters which objects were colliding. If the player dies no matter what they touch, then you can skip that step and just play the exploding animation.

If you want that one missile to explode as well, then you do need to do some more work, but at least you won’t need to do the extra work every frame.

Originally posted by Samoht777:

Anyway, the same sort of pixel perfect collision detection can be done using only 1 layer by checking for a rectangular intersection between two objects’ rectangular bounds and then doing the pixel comparison of the intersecting rectangle.

Skyboy’s class tests only the intersecting rectangle. Though now that I look at it, Skyboy creates a new bitmap each time, which could be skipped if you knew the size of the smaller rectangle in advance.

 
Flag Post

Topic: Game Programming / {AS3} Partial Blitting

Originally posted by Samoht777:

I can’t really think of any reason why you would ever want to use several Bitmap layers.

I can. Kainevg might be using something like this to check for collisions against the missiles. To make that work, the missiles would need to be in their own bitmap.

 
Flag Post

Topic: Game Programming / {AS3} Containers

Your code should match the way you visualize your game. Unless this is a game about earthquakes, don’t change the coordinates of the ground. And unless the player is on a moving platform, don’t add anything extra to their speed.

Instead, make a “camera” object. All it needs are x and y coordinates. Move the camera by adjusting its coordinates. When rendering, subtract the camera’s coordinates from the object’s.

destPoint.x = object.x - camera.x - stage.stageWidth / 2;
destPoint.y = object.y - camera.y - stage.stageHeight / 2;

sourceRect.setTo(0, 0, object.width, object.height);

blitTarget.copyPixels(object.bitmapData, sourceRect, destPoint, null, null, true);

That’s it.

 
Flag Post

Topic: Game Programming / Fastest way to compute Square Root? [solved/nvrmnd]

Originally posted by I_love_you_lots:

My code checks the x,y,w,h data on each represented object to see if it is within the camera FOV, and if so, renders the object.

So you’re looking at the distance between the object and camera?

Option 1 pseudocode:

offset = camera.position - object.position;

distance = sqrt(offset.x ^ 2 + offset.y ^ 2 + offset.z ^ 2);

maximumDistance = 50;

inRange = distance <= maximumDistance;

Option 2 pseudocode:

offset = camera.position - object.position;

distanceSq = offset.x ^ 2 + offset.y ^ 2 + offset.z ^ 2;

maximumDistanceSq = 50 * 50;

inRange = distanceSq <= maximumDistanceSq;

Note that the two are equivalent, but only one uses square roots.

 
Flag Post

Topic: Bloons Monkey City / Monkey Ace Tier 3

Originally posted by KyuZwei:

I hate the fact that the 3/x for Monkey Buccaneer makes the ship go from a Liquid Super Monkey to a useless plane spamming thing that ruins your whole run.

I assume you mean 4/x. Except… that can’t be right. 4/x deals many times more damage than 3/x and is way better at killing BFBs.

 
Flag Post

Topic: Game Programming / String's not comparing correctly, might be array population problem

It’s \r that’s left at the end of the string, and it does indeed count towards the string’s length.

 
Flag Post

Topic: Game Programming / String's not comparing correctly, might be array population problem

Originally posted by Nate_25:

(apart from the fact that the array populated from the text file seems to have new lines on it despite me splitting them at \n)

You can thank Windows for that.

 
Flag Post

Topic: Bloons Monkey City / DDT in CT are invinsible

Originally posted by TheGodOfDragons:

To defeat DDTs with massive damage (which have camo, black, lead properties) = x/3 village + anything or 2/3 spike factory or some MOAB assassin/the bucaneer ability/ground zero?(i think)

According to the wiki, Ground Zero now does exactly enough damage to pop DDTs without popping anything inside. And apparently it doesn’t matter that DDTs count as black bloons.

[More tips]

 
Flag Post

Topic: Game Programming / hitTest not working

Originally posted by THadriex:

The first bomb, an instance on the stage blows up properly. The coding is pasted on the bomb’s actionscript.

Additional bombs are pulled out of the library when you move the character to the right. These bombs do not detonate upon hitting the ground, but rather pass right through it.

There are two things you could mean by “on the bomb’s actionscript.” In AS2, you can add script to all copies of a movie clip, or you can add script to just a single copy (“instance”) of the clip. Do this test to figure out which it is:

1) Double-click the bomb in the library.
2) Click the first frame of the timeline within the bomb movie clip.
3) Check the actions panel. Is there any code there?

No? Well, there should be.

You’ve gone and put your code on one specific instance of a bomb, when what you really want is to associate it with all bombs in general. To do the latter, you have to put everything inside the movie clip. (Or better yet, switch to AS3 and make a Bomb class.)

Copy all the code on the bomb instance, delete it, and then paste it on frame 1 inside the movie clip.

This will cause the game not to compile. Don’t panic! The solution is simple: replace “onClipEvent(enterFrame)” with “onEnterFrame = function().” Then do the same for any other clip events.

 
Flag Post

Topic: Game Programming / AS3: Severe FPS drop when mouse hovering over game

Originally posted by Shake_N_Baker:

On a side note I noticed that the game also seems to pause for about 2 seconds whenever I right clicked, maybe you’ll be able to use that to help find the slow down?

That applies to all Flash games.

 
Flag Post

Topic: Bloons Monkey City / Bananas

Originally posted by Kholai:

Round 1 Farm: $1080.

Um… I think you overestimated the prices.

I just went and double-checked, and the base farm is $1000, the 1/0 upgrade is $300, the 2/0 upgrade is $1400, and the 3/0 upgrade is $3200.

 
Flag Post

Topic: Game Design / Run 3 Level Creation Contest!


Gabber Levels by GabberGaming
My rating: 2/5

I’ve confirmed that all levels are possible with the Runner, though 10 requires a particular trick, and 18 requires multiple near-perfect jumps (or going outside the tunnel). I’m almost certain that level 10 is possible with the Gentleman, though I never pulled it off.

Intentionally hiding bouncy tiles among regular green tiles (even if they aren’t quite the same shade) is just rude. I’d have let it go if it was a one-time thing and was amusing somehow, but it’s neither. That’s how other games get away with fake difficulty.

I’d give credit for playtesting, except Gabber clearly didn’t playtest with enough characters. The short-jumpers run into a lot of dead ends, and the Skater and Child have extra trouble with the lone tiles.

 
Flag Post

Topic: Bloons Monkey City / Bloon traps

Originally posted by Teroc:

There’s plenty of levels that forbid the use of farms, so we need an alternative. It’s either the engi or sniper’s supply drops.

The Monkey Village’s 10% discount is worth considering too. It pays for itself by the time you buy a Supply Drop, assuming the Sniper is in range.

 
Flag Post

Topic: Game Programming / {AS3} Problem

Is there an error message?

 
Flag Post

Topic: Bloons Monkey City / Strategy for regen bloon rush

Originally posted by jumper224:

It pops 2 layers of bloons so it’s basically double popping power.

Not if the term means the same thing as it did in BTD5. (Wiki link)

 
Flag Post

Topic: Bloons Monkey City / Use Kong file on iOS?

I’m pretty sure the games aren’t compatible. They don’t even have the same premium currency. (I forget what it’s called in the iOS version, but it’s not “Bloonstones.” And you get a different amount per mission than in the Flash version, so it’s more than just a cosmetic difference.)