Recent posts by fatjohndaly on Kongregate

Flag Post

Topic: Game Programming / What is the best way to implement a singleton.

Well somethings are going to be the same for everything that gets created, such as text formatting. Better to have one place to change that, then have to change it for every class that displays text.

Subclass TextFormat like this:

public class GameTextFormat extends TextFormat
{
    public function GameTextFormat()
    {
        super("Arial", 20, 0x00FF00);
    }
}

Then create your textfields like:

var textField:TextField = new TextField();
textField.defaultTextFormat = new GameTextFormat();

Alternatively, you could subclass TextField and set the formatting in it’s constructor, or you could find any number of different ways to solve this problem without resorting to globals.

 
Flag Post

Topic: Game Programming / Easter egg legality question

So for someone who doesnt like that song, getting redirected to it could seem quite irritating/bewildering.

It depends how you get redirected. If it’s from a hidden button in the options menu for example, I wouldn’t mind at all. I’d possibly even find it funny. If it pops up randomly during the gameplay however, I’d find that really irritating.

 
Flag Post

Topic: Game Programming / closed

except for the whole “javascript can’t load crossdomain data” thing that prevents using HTML for this from being possible.

Pretty sure you can just use PHP for this. The examples on their webAPI page use PHP.

 
Flag Post

Topic: Game Programming / closed

You’re going to need a crossdomain.xml hosted on what pulse for developers to create a facebook app in flash.

Flash would probably be overkill, I don’t think there’s any interactivity or anything particularly flashy required. Just use HTML and whatever, then people will be able to view it on iPads and stuff as well.

 
Flag Post

Topic: Game Programming / closed

It seems like a simple script to get data from http://www.whatpulse.org/stats/users/userid would work. (Example )

WhatPulse already seems to have such a script: http://whatpulse.org/webapi/

I think they just want a facebook app that will display this data nicely.

 
Flag Post

Topic: Game Programming / "Undefined" Variable Inaccuracies


class buildLocation extends MovieClip {

    var buildType;

    var buildButton;

    public function buildLocation(itemType){

        trace(“constructor”);
        var buildType = itemType;
        trace(buildType + "  " + itemType);

    }

In your constructor here, you’re creating a new local variable called buildType and assigning it itemType. You’re not actually setting the class variable buildType at all. Change it to:


var buildType;

public function buildLocation(itemType){

    trace(“constructor”);
    buildType = itemType;
    trace(buildType + "  " + itemType);

}

You only define a variable with var once, after that you can just assign to it. You make the same mistake with buildButon in the onLoad function, and with your arrays all over your GridSpace class.

 
Flag Post

Topic: Game Programming / ***Mobile Game Contest #2, another $25,000!***

i’m making an estimate based on how popular previous contests seemed

The only previous contest that even got close to a couple of thousand entries was the Shootorial one, and that was only because it had a really low entry barrier. All the other ones have had far lower interest, the current project eden contest only has 16 entries so far for example, and I’d be willing to bet it won’t reach 50 ‘serious’ submissions by the time it finished in a few weeks. Seeing as mobiles are unfamiliar territory to most developers here, I’m hoping (no offence Kongregate, all your contests are great) that take up for this contest will be pretty low as well.

A more related question, I notice on the extra credit page it mentions using air for mobile. Does this mean you want us to package the game as an .apk or something? What’s the difference between compiling a project for air and a normal pure as3 project?

 
Flag Post

Topic: Game Programming / ***Mobile Game Contest #2, another $25,000!***

a couple thousand entered

Where are you getting that information from? Only 461 games show up if you browse through the mobile site: http://m.kongregate.com/?sort=newest&srid=450

 
Flag Post

Topic: Game Programming / Robust AS3 developer suggestions

If you’re looking for free software your choices are quite limited. There’s axdt which is an eclipse plugin and so probably should work on Mac. I’ve never used it before, or have ever heard of anyone who has, but it it might be worth a look.

If you’re a student or unemployed you can get Flash Builder for free: http://www.adobe.com/devnet-apps/flex/free/. I have actually used this one myself, it’s pretty good once you get used it’s features and shortcuts. Note: I’m not sure what the licence is like for this, you might not be able to use it commercially. You’d need to check that out.

If you’re willing to pay you’ve got a few more options. There’s FDT, IntelliJ, and Realaxy, none of which are massively unaffordable (for the basic editions at least). There’s also TextMate which I’ve heard a lot of mac developers say they use, and it’s relatively cheap.

 
Flag Post

Topic: Game Programming / ***Mobile Game Contest #2, another $25,000!***

Anyone know how many people entered last time? With 25 prizes it seems you’ve got a decent shot at winning at least $400, which is easily worth spending a few days converting an old project for.

 
Flag Post

Topic: Game Programming / Game Development Graveyard

I was looking in my /projects/ folder recently, and at all the unfinished games and prototypes that I either lost interest in or got distracted from. It got me thinking, wouldn’t it be great if there was a website where you could upload your abandoned projects for others to finish? You could submit anything from a design document and some sketches to the source for a near complete game that just needs a week or so of polishing, and other people could download them and effectively take the project over. There must be thousands of great, but unfinished, games just sitting on hard drives around the world.

Does anyone know if anything similar to this already exists?

 
Flag Post

Topic: Game Programming / Getting Past Tedious Work and Keeping Interest.

You can skip most of the tedious bare bones stuff by using a framework like flixel or FlashPunk.

 
Flag Post

Topic: Game Programming / my game keeps saving as a .as

Even in a Flash project, I don’t think it’s inaccurate to say that the .as files are compiled.

 
Flag Post

Topic: Game Programming / Why don't my hittests ever work? [solved]

If you just copy/pasted truefire’s code, it’s missing a ( after the if.

 
Flag Post

Topic: Game Programming / Why don't my hittests ever work? [solved]

The code is most certainly the problem. I think your brother just assumed that you were using AS3 when he taught you, and you’ve now tried to wedge that code into an AS2 project (which doesn’t work). I don’t use AS2 but it should look something like:

function onEnterFrame(){
    if(_root.sprite_mc.hitTest(_root.object_mc))
        _root.object_mc._x += 100000;
}

I’m guessing you’re adding 100000 to move the object off the stage because you want it to disappear? You might want to look into removeMoveClip or similar. Basically find a good tutorial instead of trying to guesstimate your way through game development.

 
Flag Post

Topic: Game Programming / Why are all the new programmers starting with AS2?

Originally posted by Siveran:

Inthrees and NineFiveThree: But AS2 is still faster to write, even if it’s worse and more modern in all other aspects, thus it can’t be discounted as purely inferior.

This is from a couple of days ago but I felt inclined to reply; the idea that AS2 is much faster to write is largely a myth. Maybe if you’re just making a simple Pong clone you’ll save a minute or two but I doubt you’ll be massively faster, all I can think you have to do in AS3 that you don’t in AS2 is event listeners and imports, but they’re only an extra line each. For anything bigger than a Pong clone AS2 rapidly becomes far slower to write in because of the wide variety of AS3 only libraries. There’s nothing really like flixel, Box2D, Away3D, Player.IO etc available for AS2, and if there are then they tend to have not been maintained for 5+ years and have virtually no support available. If I want realistic physics in my AS3 game I just download Box2D or APE and include it in my project. If I want it in my AS2 game my only option is likely to be going to the library, getting a book in rigid body dynamics and trying to write it all myself.

TL;DR: just because you can technically create a button faster in AS2 doesn’t necessarily make it faster to write an actual game with.

 
Flag Post

Topic: Game Programming / Flash vs Unity

Well, sure people have to adapt, but to me all this 3d shit is no art. Some flash games are to me like a piece of art, the drawings, the style, everything, even crappy stickman games have their special atmosphere, but 3d is always 3d. or most of the time, everything looks the same.

What about Windwaker, Okami, Shadow of The Colossus etc? To me those games are far more “art” than another vector drawn 2d flash game. You can make wonderful atmosphere with 3D, probably more so than 2D if you’re willing to put the effort in.

Would anybody play ever a TD-Game in 3d?

The original tower defence was a 3D game, it started as a mod for Warcraft 3 I believe.

 
Flag Post

Topic: Game Programming / "Can I make an iPhone game with Flash?"

What do you mean by “you’ll need to find a mac to upload your game”? Do you not just submit it through a web page?

 
Flag Post

Topic: Game Programming / Kongregate Now Supports Unity

I like the ease of programming in Flash, what with the entire display and animation API pre-built for you

I’m pretty sure Unity has pre-made display and animation functionality in it.

 
Flag Post

Topic: Game Programming / [AS3] Logic behind Replay Feature within a Game

The only practical way to do this is your second option, record all the users key presses and use them to recreate what happened. You might get some inaccuracies as you say, but they should be relatively rare.

 
Flag Post

Topic: Game Programming / Communication between classes

Here’s an AS3 specific guide on understanding classes: http://www.untoldentertainment.com/blog/2009/08/25/tutorial-understanding-classes-in-as3-part-1/
If your using AS2 the concepts are pretty much the same.

 
Flag Post

Topic: Game Programming / Need help.

Hide the cursor and move a fake one around.

 
Flag Post

Topic: Game Programming / Useful for AS3 game developers.

Say I have a collection of enemies that I’m iterating through every frame, and I’m fairly frequently taking enemies out of the collection when they’re killed/leave the screen, would using the list from here be better than, say, flash’s vector? Or would there not be any noticeable speed difference either way?

 
Flag Post

Topic: Game Programming / Compiler Help

Add:

trace(isValidAddress);

to the end of your code. trace is like printf or cout in c++, it outputs to FlashDevelop’s debug console.

 
Flag Post

Topic: Game Programming / Bitmapdata.draw() help

Yes, just make the hole bitmap transparent.