Recent posts by aldrinsmoulder on Kongregate

Flag Post

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

If you can pass it where it’s needed, why have it as a singleton? You’ll save yourself a lot of problems just keeping it as a normal class.

To answer your question though, a singleton normally looks something like this:

class Singleton
{
    private static var _instance:Singleton;

    public static function getInstance():Singleton
    {
        if (_instance == null)
            _instance = new Singleton();

        return _instance;
    }
}

class Whatever
{
    public function something():void
    {
        Singleton singleton = Singleton.getInstance();
    }
}
 
Flag Post

Topic: Game Programming / Generating BitmapData in Game

This actually throws errors and is non-compilable.

My mistake, b should have been a bitmap. This should produce an identical image in 221 draw calls instead of 12120.

var b:Bitmap = new Bitmap(new BitmapData(SIZE, 120 * SIZE, true, 0x000000));
			
p.x = SIZE / 2;
for(var r:int = 0; r < 120; r++) {
    p.y = SIZE / 2 + r * SIZE;
    p.rotation = r;
    b.bitmapData.draw(p, p.transform.matrix, p.transform.colorTransform);
}
			
for(var a:int = 0; a < 101; a++) {
    b.x = SIZE / 2 + a * SIZE;
    b.alpha = a / 100;
    _bmd.draw(b, b.transform.matrix, b.transform.colorTransform);
}
 
Flag Post

Topic: Game Programming / Generating BitmapData in Game

I’m pretty sure you can dramatically reduce the number of loops you need. Try this for starters

var b:BitmapData = new BitmapData(SIZE, 120 * SIZE);

for(var r:int = 0; r < 120; ++r) {
    p.y = SIZE / 2 + r * SIZE;
    p.rotation = r;
    b.draw(p, p,transform.matrix);
}

for(var a:int = 0; a < 101; ++a) {
    b.x = SIZE / 2 + a * SIZE;
    b.alpha = a / 100;
    _bmd.draw(b, b.transform.matrix, b.transform.colorTransform);
}
 
Flag Post

Topic: Collaborations / Sponsorship

A sponsorship, everywhere, is defined as a supportive sum of money in exchange for branding, …

This is the crucial part, a sponsorship is money or resources to support the production/development of a project. This isn’t just grasping at straws, all of your links make clear that sponsorship money is specifically intended to support an event/product. When you sponsor a race driver, you pay for maintenance to the car so that they can continue racing. When you sponsor a athlete, you buy them equipment to help them train and stay competitive. You can’t “sponsor” a completed flash game because there are no future expenses, you’re not supporting anything anymore. Paying for branding on a finished product/service is not a sponsorship.

 
Flag Post

Topic: Collaborations / Sponsorship

Every sector of the economic globe uses sponsorship to mean the same thing FGL does.

No they don’t, the quote I gave you is FGL themselves stating that “sponsorship” isn’t accurate and explaining why they use “sponsorship” differently to everyone else. Most sectors of the economic globe would probably use “licensing”, which is why FGL uses that term most of time, and why it’s called FlashGameLicense instead of FlashGameSponsorship. I’m not going to argue any more though, the last few pages have shown this isn’t going to go anywhere.

 
Flag Post

Topic: Stencyl / Stencyl has a bad name

Originally posted by GameBuilder15:
Originally posted by Senekis93:
Originally posted by GameBuilder15:
Originally posted by saybox:

AS1, with occasional flashes of AS2 brilliance.

My programming isn’t neat or ultra efficient, but I go by the idea that if it works, its good enough.

though you can still add me on AIM if you like.

You use AS1? Wow, I thought that was dead.

Just as you do.

That’s AS2, even if it has some AS1 elements, it’s still AS2.

The only real differences between AS1 and AS2 are classes, and the ability to give variables types. Seeing as you don’t seem to do either, you’re using AS1.

 
Flag Post

Topic: Collaborations / Sponsorship

The OP did have a point actually. “Sponsorship” isn’t really the most accurate word to describe what happens with most flash games. Taken from FlashGameLicense’s What is a sponsorship? page:

The term ‘sponsorship’ may have fit a little better in the past when most deals involved an exclusive branding license, but we continue to use the term today because it is handy to have one term to cover all the various different types of deals that are possible.

 
Flag Post

Topic: Game Programming / can game be site protected and also put to mochi?

I think you can opt out of mochi distribution when implementing their ads.

You don’t need to remove mochi for Kong, the ads are automatically disabled.

 
Flag Post

Topic: Game Programming / EZPlatformer for Flixel/Flex SDK

Add trace("hello"); to the EZPlatformer function and the create function, make sure they are both actually being called.

 
Flag Post

Topic: Game Programming / EZPlatformer for Flixel/Flex SDK

Originally posted by Senekis93:
I deleted it since it didn’t seem to do anything.

Really? You deleted your document class and now wonder why nothing is working?

The project wouldn’t compile at all if no main class is set, so it can’t be that. I really can’t see what the problem could be. When you created a new project, was it just an AS3 project or an AS3 project with preloader? Are you using the latest version of flixel from the flixel.org website or do you have an older version?

 
Flag Post

Topic: Game Programming / EZPlatformer for Flixel/Flex SDK

It looks fine to me, you should get a nice grey background. You have a useless empty [SWF] tag but I don’t think that would affect anything. Is EZPlatformer.as your main class? FlashDevelop sets Main.as as the main class by default.

 
Flag Post

Topic: Stencyl / Stencyl is a failure.

The simple fact is those who take the time to truly learn Adobe Flash from the ground up will end up making the best games – games that cannot and never will be made from these types of ‘make it easier for the masses!’ type of programs – like Stencyl.

I disagree; the vast majority of the top rated games here on Kongregate could easily be made in Stencyl. In fact, several of the top rated games here were originally created in a Stencyl-like “make it easier for the masses type program” called GameMaker; Mr Karoshi, Depict1, and Tower of Heaven are just a few off the top of my head, I could give you pages more if you wanted. The best games will be created by the most creative and hard working people, regardless of what tools they use.

The only sense in which you could call Stencyl a failure is that it’s so far failed to attract a substantial user base, but seeing as it’s only been released a month and has had minimal advertising that’s only to be expected. Hopefully it’ll gradually get more well known and we’ll see more talented people using it in the future.

 
Flag Post

Topic: Collaborations / Looking For a Team

Suddenly there was a blue Screen in front of him as a screen appeared in front of him.

You certainly have a skill in writing. If all you are doing is planning ideas at the moment, you don’t need a team yet. Get all your ideas down on paper first, make a prototype in RPGMaker or similar, and then you can try and recruit people for a Flash version.

 
Flag Post

Topic: Game Programming / is it worth using Flash game engines

A “game engine” provides core functionality such as a rendering engine, a physics engine, sound, scripting, animation, artificial intelligence, networking, streaming, memory management, threading, localization support, and a scene graph.

I see you left out “typically” when you copied that from wikipedia, a library does not have to cover every single one of the features to be considered an engine. Are you saying if you took the localisation support out of Source it would suddenly just be a renderer? The line between when a framework becomes a game engine is obviously fuzzy, but I think flixel contains more than enough logic to be able to call itself such.

So Flixel may be close. It’s rendering and physics so far. But it doesn’t do AI, networking, localization, sound, or scripting.

flixel does do sound actually, and it also does pathfinding which techinally comes under AI.

 
Flag Post

Topic: Game Programming / is it worth using Flash game engines

To work with equivalents they are more like LWJGL.

Not really. LWJGL is just an abstraction of some graphics and sound api’s, it doesn’t contain any game logic such as collisions, physics, and pathfinding like flixel does.

So I do agree that an engine isn’t the right word

It’s a far more accurate word than renderer is, and your previously good post has become a little confusing now that you’ve unnecessarily changed it. You’re probably tired of editing it, but if you really have a huge objection to “engine” I’d at least change it just to use “framework” or “library” to make it a little clearer.

 
Flag Post

Topic: Game Programming / is it worth using Flash game engines

So I do agree that an engine isn’t the right word,

I’d argue that it is. Or at the very least, it’s a far more accurate term than renderer. “Game engine” is a relatively recent word so there’s not really a dictionary standard definition, but if we take the one from here:

Generally though, the concept of a game engine is fairly simple: it exists to abstract the (sometime platform-dependent) details of doing common game-related tasks, like rendering, physics, and input, so that developers (artists, designers, scripters and, yes, even other programmers) can focus on the details that make their games unique.

well, that’s exactly what flixel is. I’ve not used FlashPunk, but I hear it offers most of the same functionality. You’re probably tired of editing your first post, but I’d replace “render” with just “framework”. It’s less confusing, more accurate, and a term we can probably all agree on.

 
Flag Post

Topic: Game Programming / is it worth using Flash game engines

flixel is a lot more than just a renderer. It handles collision detection/reaction, sound, animation, pathfinding, state management, user input, save files, particle systems, Kongregate integration, tilemaps, and so on. You can call it a game framework or game library if you want, but saying it’s only a renderer is seriously selling it short.

 
Flag Post

Topic: Game Programming / is it worth using Flash game engines

I strongly recommend use a game engine, they literally cut about 80% of your development time on most decent sized projects. I use flixel, Cloud_9ine is right in that it sometimes does a bit too much (I had to go into the source a few times and disable some of things it was doing, as it was conflicting with what I wanted to do), but it was otherwise perfectly enjoyable to work with. I’d be willing to state that my game probably wouldn’t be as high quality if it had been entirely my own code.

 
Flag Post

Topic: Game Programming / "Undefined" Variable Inaccuracies

I can’t see where buildType is set at all; are you calling setBuild() from somewhere outside the class or in the switch statement?

Some minor problems, I don’t think you need to set the button’s onRelease() function every frame, just move that into onLoad(). Also, class names should always start with a capital letter, so that you don’t accidentally confuse them with variables.

 
Flag Post

Topic: Game Programming / Locking Screen Orientation on Mobile Device

I’m making a game for the mobile competition, and I’m wanting to lock the screen orientation to landscape. I’ve noticed there’s a autoOrients property of stage, but it seems to be AIR only so won’t work when played in the mobile’s browser.

On the Kongregate sizing tips page there is a hack for doing this, but the article is at least a year old. Does anyone know if I can still be reasonably certain that this hack will work on most devices?

Edit: I tried the Video hack in Device Central, didn’t seem to work but that might just be because its an emulation. Looks like I’ll need to find a physical device to test on.

 
Flag Post

Topic: Game Programming / Please Help! Open-Ended Questions In Flash 8

Have an object that contains the question and correct answer, show the question on the screen and then check the user input to see if it’s the same as the answer. I guess it would look something like:


currentQuestion = nextQuestion();

questionTextField.text = currentQuestion.questionString;

function onKeyDown():void
{
    if (answerTextField.text.equals(currentQuestion.answerString))
        setAnswerCorrect();
}

What the nextQuestion() function looks like depends on how you’re storing the questions, ie in an xml/json file, hard coded into you swf etc.

 
Flag Post

Topic: Game Programming / Stencyl - Flash Game Creator

It looks to me like something has set the game height or width to 0 or some other invalid value, and it’s throwing an error when it tries to create a bad bitmapdata. I haven’t used Stencyl so I don’t know what’s causing this, check if there’s anywhere you can set the game size and make sure the values are correct. Seems like it could be a bug, as Stencyl (and flixel) should probably check that the game size is valid and throw a more descriptive error.

 
Flag Post

Topic: Game Programming / Wink Tutorial strange resolution on kong

@OP: the only thing i can think of that’s wrong is that wink is improperly setting the width/height because they don’t know the format.

Is it something he could easily fix with something like a hex editor? Or I suppose he could just get someone with the flexsdk to embed his swf into another that is the right size?

 
Flag Post

Topic: Game Programming / I Need Comments

A free roaming multiplayer zombie themed first person shooter is a pretty ambitious project, how much game developing experience do you have?

 
Flag Post

Topic: Game Programming / NEED HELP [AS2]

I’m guessing _root.score is a string, so you’re concatenating instead of adding.