Recent posts by NineFiveThree on Kongregate

Flag Post

Topic: Game Programming / What is a 'package'?

Yes, that would be an example of how packages are used.

Originally posted by Gamerboy98:

Try to give me another practical example if you can.

The classes of As3 itself are organised into packages, take a look:

Flag Post

Topic: Game Programming / Need your opinion for a just published game

The graphics look good, but they are not consistent.

The bird features a lot of gradients.
The landscape has something like cel shading.
And the bag with the hand is just a flat image with outlines.

Whatever your sources for graphics are, try to pick a consistent style next time.

Placing a tree so it is exactly halved by the edge of the screen does not look that nice.
Place it more into or out of the frame.
Better yet, make the background scroll according to the movement of the bag, to create more depth.

Performance is good. I have to agree with player_03.
You’d have to put some effort into making this lag. There’s nothing going on.

Flag Post

Topic: Game Programming / As3: Problem removing eventlistener

Originally posted by darkjonas8:

Well, i dont really get the blur filter you are talking about. I want a kind of trail after my character, not something like a gaussian blur.

Now I get it.
There’s a different approach to achieve the same effect that eliminates the need to remove the objects.
Have one bimap and draw your player into that bitmapdata every frame.

If also constantly apply the transform of reducing the alpha value, it will have the same effect – a trail behind the character.

Flag Post

Topic: Game Programming / As3: Problem removing eventlistener

Originally posted by darkjonas8:

but will i be able to simply remove the clip without any problem when the tweenlite transition is done?

You can specify a function to be called, when the animation finishes.
Did you consider applying the filter?

Flag Post

Topic: Game Programming / As3: Problem removing eventlistener

Originally posted by darkjonas8:

The only other reference i have to PlayerBlur is in my Game class, which is just:

                        var mb:PlayerBlur;
			mb = new PlayerBlur;
			mb.x = player.x;
			mb.y = player.y

You’d have to make sure this reference does not persist.
So if this isn’t a local variable, you should set it to null when you want to remove it.

That’s one reason why I would not let display objects remove themselves.
Also take a look at the other suggestions.

Flag Post

Topic: Game Programming / As3: Problem removing eventlistener

If you want to blur your player, why don’t you apply a blur filter to it?

If you want to change some property (in your case the alpha value) over time, use a tween library.
Tweenlite is a popular one, but there’s also a built in one:

As3’s Tween class is not so good, but it will get you started.

It is a lot more convenient than this DIY- ENTER_FRAME animation.
You can simply specify the beginning and end values and how long the transition should take.
In addition to that, you can specify what should happen when the animation is finished.

Regarding your original problem:
Trace out the alpha values to see what’s going on (you will probably be surprised)

Flag Post

Topic: Game Programming / No blank screen, debugging mode or trace statements seen

Try to create a new project.

Flag Post

Topic: Game Programming / No blank screen, debugging mode or trace statements seen

Originally posted by Gamerboy98:<br|

not only am I not getting the window, but I am not entering debugging mode and the strings in my trace statement are not appearing in the output window.

…and none of the other things you will try to accomplish in step whatever will work because you did not fix the problem you have with step 3.
And that’s why I suggested going through these steps in order.

If anything broke it’s your hope of it somehow magically working anyway even though you expected it to fail yourself.
Don’t blame me, it’s not my fault.

Thanks for changing the thread title. It helps to attract smart members of this forum.

After this off topic stuff, let’s focus on the problem again.
I’d still like to see whatever the output panel throws at you when you test the flash.
Just select everything and post it.

Flag Post

Topic: Game Programming / Problem with loop and buttons

You posted your code in a wrong way so it shows up strange.
But it looks like you are trying to assemble the names of your buttons.

There’s a better way: use an array. Put all buttons into one array and iterate over that.

If you have a bunch of similar things that you want to group together, use an array.
Put your enemies in an array.
Put your buttons in an array.

If you have a bunch of different things that you want to group together, use an object.
Put all the properties that an enemy has in an object.

As the enemies probably play an important role in your game, you’d want to create a class for them anyway.

Flag Post

Topic: Game Programming / No blank screen, debugging mode or trace statements seen

Originally posted by Gamerboy98:
Originally posted by NineFiveThree:

First of all, try to find some sane descriptive titles for your threads.
You state you cannot describe your problem easily, yet your post is only 2 sentences long.

I mean I can’t think of a good title for it. Besides, it stands out so I can get a quicker answer.

So you are spamming. Stop that. Generic thread titles do not stand out.
You don’t have to “think” of the title, just summarize your post in a few words.
“no window in FD when testing project”
“no blank screen in FlashDevelop”

Originally posted by Gamerboy98:

It says that there aren’t any errors, yet it doesn’t pop up.

Hello World! Doesn’t even show on the output screen.

“Hello world” is step 4 of this tutorial.
You have trouble with step 3.
You are supposed to follow those steps in the right order.

If you do not get an error message, what do you actually get in the output panel?
Please post everything.

Flag Post

Topic: Game Programming / Animating via code plus other issues

Well, you’re the programmer. You define what’s possible.

So you have some state (running).
And there’s something that causes this state to possibly change (hitting the attack button).
Now it’s your turn to say what should happen:
either “Ok, that’s fine, you can do this, we switch to the running-and-attacking state
or “dude, this is not going to work, we discard that hit of the attack button, because there’s no attacking while running. We stay in the running state
or “sure enough you can attack, but the running stops because of that, because there’s no running while attacking
or whatever else you want.

When you say there’s a “clash” it sound more like a lack of definition what’s supposed to happen.
Maybe you can explain a little more.

Flag Post

Topic: Game Programming / No blank screen, debugging mode or trace statements seen

First of all, try to find some sane descriptive titles for your threads.
You state you cannot describe your problem easily, yet your post is only 2 sentences long.

The tutorial states that there are things that can happen when you test the project:
Your Output Pane (at the bottom of your screen) will start to show some incomprehensible lines, describing what the compiler is doing. After a few moments, you’ll either get some kind of error message (Bad News!) or you’ll see a blank window pop up on your screen, with “Adobe Flash Player” in the top right corner. That’s your program. Let’s celebrate!

As you do not get a window, you want to check if you get any errors.
The flash player is obviously only executed if building your program was successful.

Flag Post

Topic: Game Programming / Using or sybmols in if conditions

If you want to identify strings, I suggest you make yourself familiar with regular expressions.

The reason that you have to re-enter “HOT” is caused by something else in your code.
You should show more of your code.

You can easily test this if statement separately, to check what causes the error.
Simply fill the array with the expected elements and execute the if statement to see what happens.

Flag Post

Topic: Game Programming / What is an 'Object' and 'Class'?

Originally posted by Gamerboy98:

So, should I sort of imagine it like this: A Class is a factory, functions and such in the class are workers, objects are products produced by the factory, instantiation is the process of making the product and instances are the individual products.

Or like this: The computer is a factory that can produce everything and the classes are orders received by the factory, while everything else is same.

I guess you are overcomplicating things.
Look at all the things around you (whatever they might be). Those are all objects. You can touch them. These are the things you can do stuff with.
Some of them are somewhat similar. You could come up with a category they belong to.

An example would be the keys on your keyboard.
Each individual key is different.

But you could put all of them into the category “keys”. They all share the common behaviour that when you push them, something happens.
These categories of things are classes.

Flag Post

Topic: Game Programming / Creating/importing .sav Files in AS3

Originally posted by Apple0726:

I heard using that method isn’t possible for web games for security purposes

The File class is limited to Air, because it can save at an arbitrary position without asking for permission.

Flag Post

Topic: Game Programming / What is an 'Object' and 'Class'?

A class is a type, like int. (integer)
An object is a value of a type, like 5 is a value of type int.

You can define your own classes, which according to the above means you can define your own types.
A class defines a type and therefore what the values (objects) of that type can do.

You are a human. You are an object of the class Human.
There are other objects of the same class, say your parents for example.

It seems like all humans have two arms two legs, a heart, etc.
That would al go into the class definition.
But there are other properties that can change from one object to the other, like skin, eye and hair color, name, place of birth.
There are also properties that change throughout the lifespan of the object, say spoken languages for example, ability to walk, age, etc.
These properties are the variables of the Human class.
They can vary in value from one object to the other, but each object has them.

I for one am an object of class Robot.

Flag Post

Topic: Game Programming / As3 incorrect number of arguements

What a mess.

People start class names with a capital letter and variable names with a small letter for a reason.
In your code it’s all over the place.

Following that convention, your code should look something like this:

var player:Player = new Player();
addChild(player);  // in your original code, you try to attach the class

variables small, classes big, ok?

player seems to be a more or less important object for your application.
I doubt that the only place you want to use it is the constructor of the Game (big letter, remember?) class.
Do not declare the player variable locally in the constructor, but class wide.

This holds true for all other variables in your Game class, declare them in the class block, as you do in the player class.
Make them all private and give all of them a type.


Always use the defined constants. You sometimes do and sometimes you don’t. try to be a little more consistent.
This prevents you from mistyping the string, which is one of those hard to find errors.


var b2:block2;
var b3:block3;
var b4:block4;
var b9:block9;
var b6:block6;
var b7:block7;
var b8:block8;
var b11:block11;
var b12:block12;
var b5:block5;

If you need multiple variables of a certain type, create an array.
Such duplicated code is hard to maintain and due to the additional inconsistencies (what’s with block1?) hard to read.

for (var i:Number = 0; i < level1data.length; i++)
                for (var j:Number = 0; j < level1data[i].length; j++)
                if (level1data[i][j] == 10)
                b2 = new block2;
                        b2.x = tileSize * i;
                        b2.y = tileSize * j;
                if (level1data[i][j] == 3)
                b3 = new block3;
                        b3.x = tileSize * i;
                        b3.y = tileSize * j;

This copy and paste stuff will cause headaches.
Prevent duplicated code if possible.
You could easily turn this into generic code.

The indentation of your code is not that good.
One main point of services like pastebin is to maintain that indentation.

An additional option to passing a reference to Player in order to call a function on Game, Player could dispatch an Event, that Game would listen for.
This is possibly preferable.

Originally posted by aenil333:

player class doesnt seem to be imported in game class that could cause the error when trying to instantiate it

As both classes are in the same package, I don’t think this is the issue.

Flag Post

Topic: Game Programming / AS3 Applying

Originally posted by aenil333:

You dont agree to what… you mention flash builder is better… but made by adobe…

I do not agree to what I quoted.

also see Ambibtious post

Flag Post

Topic: Game Programming / AS3 Applying

Originally posted by CaptMilkshake:

Couldn’t you just use Photoshop as the drawing program?

Or any other bitmap manipulation software.

Just because Adobe Flash bundles some drawing tools with a code editor, doesn’t mean you always have to scramble them together.
And if you think about it, other tools are often a lot more powerful at what they do. Photoshop you mentioned is a good example.

Flag Post

Topic: Game Programming / AS3 Applying

Originally posted by aenil333:

All those program do code completion but adobe will always be more accurate because its their thing.

I do not agree.
The Flash code editor sucked balls and I wouldn’t be surprised if it still does.
This is one reason Flash Builder exist. They wanted to get more programmers into Flash, but those did not like to use a drawing program for serious work.

Flag Post

Topic: Game Programming / Split my project into multiple files

You can export things into swc files, which can be used by other parts of your project.

Flag Post

Topic: Game Programming / Flash Builder

FlashDevelop is not a “free version” of some other software.
It’s an application of its own, independent from Adobe.

The bare minimum would be the compiler (which is free, available from Adobe).

Use FlashDevelop, Flash Builder, notepad++, Eclipse, Intellij IDEA, nano, vim, emacs or whatever other text editor you prefer to edit your code. (some of them are free, some are not)
Then compile that code with the compiler. Some of the mentioned editors handle the call to the compiler very conveniently, provide project organisation, etc. One would call them an IDE.
If you are looking for a free program, FlashDevelop is a good choice.
But again, those are just text editors.

If you want to create visual assets, you’d have to create them with some tool that does that, say Adobe Photoshop, gimp, blender, Adobe Flash etc.
Note that the later also does compile actionscript.

If you need to create music…same story.

Flag Post

Topic: Game Programming / Custom Class

It’s a convention to start class names with a capital letter, which makes it easy to distinguish them from variables and other things.
It’s not a good idea to add things to stage. Add them to the main time line instead.
So your code would probably look more like this:

var enemy:Enemy = new Enemy();
Flag Post

Topic: Game Programming / The anormal case of the pear [FINALLY SOLVED YEEEEEEEEE!]

As I explained earlier, the point of the container is to hold the second frame of the coin animation.

Originally posted by dragon_of_celts:

The code works, okay. That doesn’t mean that it doesn’t have parts that can be excised. Maybe oldPearContainer does something, but I don’t see how: nothing, in the code on this page that I can see, ever adds anything to it, nor does it do anything but removeChildren (which, if it never has children, won’t do anything).

953 wrote, I assume regarding oldCoinContainer: ‘Your coin “animation” only has one additional frame. I picked the shortcut of putting them in a container that is cleaned every frame.’

OK, I’ll take his word for it, but I don’t see where that’s happening. Where is anything put in the container? Please point to the line(s) of code where this happens, because for the life of me, I can’t see it.

You’re right, I missed adding it to the container and instead add it to the main time line.
My bad.

The original code had the problem of switching to the second frame of a collected pear, which required the MC to persist on the display for one more frame.

Originally posted by chachon2:


The oldPearContainer was a stuff created by 953 in the code that works, but I didn´t even know that it serves….

Then why didn’t you ask?

In your current code, you never remove the collected pear asset.

Flag Post

Topic: Game Programming / The anormal case of the pear [FINALLY SOLVED YEEEEEEEEE!]

Great to hear you could solve it.
It will now always save the state the game is in.

I’m not sure why the other way caused a problem.