Recent posts by Maqrkk on Kongregate

Flag Post

Topic: Game Programming / Game Design forum?

/support :)

 
Flag Post

Topic: Game Programming / (AS3) Reference to an Array Instance

Try adding " as MovieClip" after the e.currentTarget.

public function clickObject(e:MouseEvent):void

{

   objectInUse = e.currentTarget as MovieClip;

}
 
Flag Post

Topic: Game Programming / Web design help

If you’re unexperienced with any of this I suggest just downloading existing forum software. If you really want to try, read up on some PHP:

http://www.w3schools.com/php/default.asp

 
Flag Post

Topic: Game Programming / (AS3) Reference to an Array Instance

When an object is clicked on, the MouseEvent will know which object this was. So if you’ve made your onClick function like this:

private function onClick(e:MouseEvent):void

The variabele ‘e’ now holds the MouseEvent object. To refer to the object that was clicked, use:

e.currentTarget.

Example:

private function onClick(e:MouseEvent):void
{
e.currentTarget.x = Math.rand() * 100;
}

 
Flag Post

Topic: Game Programming / Programming help please!

Yes. Forget about Flash CS#, FlashDevelop is, in my opionion, far superior to Flash CS, codewise atleast. It takes some getting used to, though.

 
Flag Post

Topic: Game Programming / Dynamic text style

To put a textFormat on a TextField, use the ‘defaultTextFormat’ property:

http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/text/TextField.html#defaultTextFormat

 
Flag Post

Topic: Game Programming / is it being dragged? - *thanks Maqrkk*

Can’t you just use a boolean like isBeingDragged that you set to true when the startDrag function is called, and set to false when stopDrag is called?

 
Flag Post

Topic: Game Programming / What frame rate do you use?

I usually use 30, aswell :)

 
Flag Post

Topic: Game Programming / Event Listener Question(s)

You have to add it again when you re-add your object anyway, when it’s garbage collected.. ?

 
Flag Post

Topic: Game Programming / Stop(); function help...

I don’t know what error this is, could you copy/paste it?

 
Flag Post

Topic: Game Programming / Event Listener Question(s)

I agree with jonathan, because there is no reason not to remove it.

 
Flag Post

Topic: Game Programming / Removing the last character from a string!

Examples often have names like myString, myFunction, myClass.. I guess it makes it easier, so you don’t need any more info to confuse you :P

 
Flag Post

Topic: Collaborations / testers wanted

Could you give more details about the game? I’m a programmer myself, and I know what to look out for, but if the game is a genre I don’t like, or don’t know much about, there’s probably not alot I can do ;)

 
Flag Post

Topic: Game Programming / Help, button in an Mc (solve)

Are you sure that your MenuInGame class contains the upgradeButton? If it does, are you sure it’s set as a ‘public’?

 
Flag Post

Topic: Game Programming / Help, button in an Mc (solve)

Where does the last line come from. frupgrade?

Also, could you copy/paste the exact errors you’re getting? Makes it alot easier.

 
Flag Post

Topic: Game Programming / Help, button in an Mc (solve)

Let’s assume that where you put the eventListener, you have the menu as a variable ‘menu’. Also, the upgradeButton should be a public variable of the menu class, so it can be accessed from outside.

Then you can just write:
var button:WhateverClassThisIs = menu.upgradeButton;
button.addEventListener(MouseEvent.CLICK, upgrade);

There are tons of ways to do it, but this is the way I’d use.

 
Flag Post

Topic: Game Programming / "optimized for mobile devices"

I guess Kongregate is preparing for the future. There are more and more mobile devices capable of this, so I’d say it’s worth it, definately.

 
Flag Post

Topic: Game Programming / Help, button in an Mc (solve)

upgradeButton.addEventListener(MouseEvent.CLICK, upgrade);

 
Flag Post

Topic: Game Programming / Flash 4 help

If you are working with AS3, add an EventListener to the stage to listen for KeyboardEvents:


stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
// This means, every time a key is held down, the ‘keyDownHandler’ function will be called, which I will write now:

private function keyDownHandler(e:KeyboardEvent):void
{
// The variable ‘e’ now holds information about the event. e.keyCode will hold the code of the key that was pressed.
if(e.keyCode == 38)
{
// Put code here to be executed when the UP arrow is pressed.
}
}

 
Flag Post

Topic: Collaborations / Looking for art for experimental Flash game

Originally posted by Leguma:

A game size of 200X200 is minuscule. It would look bad on most portals (because they were designed for much bigger game sizes), would not be able to fit the majority of in game ads (most are bigger than your whole game), and ultimately huts the player’s eyes because most people today have high resolution monitors and this would be a very small area on their screen.

I know it is minuscule. That’s the point. To be able to make a game in such a tiny space. I’ve made a demo of my platform engine of 100×100, with the main character being 15×25 pixels, and I wouldn’t say looks awful because of the size. If it ends up being too small, I can always adjust the size.

Originally posted by Leguma:

If all that were not enough, from a game design perspective, that size is an abysmal choice. With 20×20 tiles (any lower and it becomes impossible to actually depict anything in one tile) you’re looking at a 10×10 playing screen, even Super Mario Bros had twice that much, in order to accommodate visibility of the area around you, which is key in platform games to allow the player to actually wee what is around him, where they will land after that jump, if there is any place to go up, etc, etc. If your engine is one of those screen-swapping ones, where you change the screen instead of scrolling through an even bigger level, then it is even worse since you will need a border of 1 tile to be used for the logic triggers for transition, leaving you with only 8×8.

The tiles I drew myself are 15×15px, in the 100×100 example, so that shows just over 6×6 playing tiles. But, I don’t think that a problem, since the idea is based around that (you’d hold a torch, the only source of ‘light’ in the game, so you’d only see 3/4 tiles wide anyway). Making it 200×200 already gives over 12×12 objects, which I think is more than enough for this game.
As for the engine, it’s a scroller, it centers the player and moves the world as you move in it. (And you’re wrong about the logic trigger thing, that can be done any number of ways ;) )

 
Flag Post

Topic: Game Programming / How to delete MovieClips?

Try tracing ‘this.numChildren’ every time you create a circle. (In the tick function of your main class) If it exceeds far past 1000, something’s wrong. If not, it’s likely that something’s keeping the garbage collector from collecting the removed circles..

 
Flag Post

Topic: Game Programming / How to delete MovieClips?

It’s logic, really. In your main class, you create a timer that fires every 1ms, that runs a function that creates a new circle:

var timer:Timer = new Timer(1);

The value that you give the timer function is the amount of milliseconds. If you want it to fire every second, type this instead:

var timer:Timer = new Timer(1000);

Creating 1000 circles every second equals 10.000 circles every 10 seconds. No wonder your memory goes up :)

As for the timer in the circle class:

var timer:Timer = new Timer(10);

It ticks every 10ms, meaning 100 times per second. You decrease alpha by 0.01 every second, meaning that after 1 second it’s down from 1 to 0, and the instance gets destroyed.

 
Flag Post

Topic: Game Programming / How to delete MovieClips?

That may be due to the fact you try to create 1000 new circles every second? What error do you get?

 
Flag Post

Topic: Game Programming / How to delete MovieClips?

I think the problem is that, after removing an instance, the tick function inside that instance runs again, and tries to delete the child again.

So instead try this:

if(!alpha)
{
parent.removeChild(this);
removeEventListener(TimerEvent.TIMER, tick);
}

EDIT: That is in the tick function of Circle.as :)

 
Flag Post

Topic: Game Programming / viewing trace

In the Output panel.

View → Output Panel.