Recent posts by creeplover on Kongregate

Flag Post

Topic: Game Programming / [Solved] Looking for the proper object to serve as the game engine

This will help you:
http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7dfa.html

 
Flag Post

Topic: Game Programming / New Proggrammer

Here’s a new popular code teaching website: http://www.codecademy.com/

 
Flag Post

Topic: Game Programming / Memory Management

For adding a new bird:

private function addBird():void {
  if(birds.indexOf(null)==-1) {
    birds.push(new Bird());
  } else {
    birds[birds.indexOf(null)] = new Bird();
  }
}

Enter frame event:

for(var i:uint = 0;i<birds.length;i++) {
  var b:Bird = bird[i];
  b.update();
  if(b.needsToBeRemoved) {
    removeChild(birds.splice(i,1)[0]);
  }
}

Will that work? It looks a bit odd to me, but I can’t tell.

 
Flag Post

Topic: Game Programming / Memory Management

So I have a list of MCs (Birds) stored in an array.

var birds:Array = new Array();

birds.push(new Bird(x,y));
birds.push(new Bird(x,2*y));
...

When a bird travels off the screen, I need to remove it. Because the birds travel at different speeds, the array needs to have elements removed from anywhere in the array.

To remove the bird that traveled off the screen, I call (in the Bird class):

MovieClip(parent).removeChild(this);

This removes the child from the stage, but the object is not picked up by the GC because it is still in the array.

I don’t know how to remove the bird from the array because…

- I don’t know what element index number the bird is
- The element id can’t be stored in the Bird MC because that id changes when other birds are removed from the array

So my question is… How can I remove an element from an array if I don’t know where it is?

 
Flag Post

Topic: Game Programming / Text Question

Ah.. Perfect.

 
Flag Post

Topic: Game Programming / Text Question

I have a textField and text in it. Wordwrap is enabled. Sometimes the text runs on to the next line and sometimes not. Is there a way to find out if it wrapped or not? (can I find the y position of the last character of the text)?

Also is there a way to have uniform spacing between all characters of the text?

 
Flag Post

Topic: Game Programming / Beginning website developer

www.w3schools.com is awesome. Go there.

 
Flag Post

Topic: Game Programming / Shared Objects on Mobile?

Can mobile phones store shared objects?

 
Flag Post

Topic: Game Programming / Reflection

Solved.

@lobstershow That only works for shapes, not objects.

 
Flag Post

Topic: Game Programming / Reflection

Check your pms.

 
Flag Post

Topic: Game Programming / Reflection

Yeah, but that is a messy way of doing it. It limits me to having a solid colored background. Thanks anyways.

 
Flag Post

Topic: Game Programming / Reflection

How can I make an object have a reflection (under it) that starts at 100% alpha at the top of the reflection and fades to 0% alpha. I know how to do it with just shapes, but not whole objects.

Like this: http://www.winsupersite.com/images/reviews/front_row_01.jpg

Object
Top: 100% alpha
Bottom: 0% alpha

 
Flag Post

Topic: Game Programming / V-Cam and HUD

Make 2 objects
1 object as the background. Change the x,y to move.
1 object as the HUD. Don’t change x,y.

 
Flag Post

Topic: Game Programming / Anyone know of a good start tutorial for flash games ?

http://www.flashandmath.com/basic/index.html

 
Flag Post

Topic: Game Programming / GotW #3 (China)

I’m leaving to China in an hour. Good luck all!

 
Flag Post

Topic: Game Programming / Boost game ratings...

I’d say that rating are based on:

50% graphics
30% game-play
10% story
10% music

After playing your Sector 12 game, I’ll rate it like a common user.

Graphics: 25/50
Game-play: 10/30
Story: 5/10
Music 7/10

Total: 47/100 = 2.4/5 stars

Graphics: You have a poor style of beveling your objects, by adding white and black on the sides. The logo is good. The gun, robots, and scenery looks very unrealistic. You should try to go for a more cartoonish look.

Game-play: Very unoriginal. Movement is poor. Robots move poorly and are hard to shoot.

Story: Story is lacking, but you do manage to provide an intro before each level.

Music: Background music is okay, and matches the theme of the game, but most people don’t like hard rock music. Sound effects can get annoying.

 
Flag Post

Topic: Game Programming / Date difference

Yup. It works. It has been 3484889906449 milliseconds since Jan 1st Year 0 AD

 
Flag Post

Topic: Game Programming / Date difference

Infact, I used this with a recent project (a ticker).

//year,month (0 based, so I subtraced 1),day,hour (0-23),min,sec,ms
private var then:Date = new Date(2000,8-1,30,14,59,44,2464);
private var now:Date;
private var difference:Number; (because can be larger than int.MAX_VALUE)

public function Main() {
     addEventListener(Event.Enter_Frame,onLoop);
}

private function onLoop(e:Event):void {
     now = new Date();//updates to current time
     difference = now.valueOf()-then.valueOf();
     //traces ms difference between time.
     //if you want difference in days, months ect, just divide
}

//NOTE: only works if both dates are after Jan 1st, 1970
    
 
Flag Post

Topic: Collaborations / Storyline Writer

Show an example to prove your skill.

 
Flag Post

Topic: Game Programming / Is it really worth it to switch to AS3?

It is 100% worth it. It makes everything much easier and more organized. You can do pretty much anything with AS3. It is really easy to learn and expand your vocab if you already know the basics.

http://gamedev.michaeljameswilliams.com/2008/09/17/avoider-game-tutorial-1/

^That tutorial will give you the basics. (although I don’t like using timers)

 
Flag Post

Topic: Game Programming / Child Removing

I guess you cache them as bitmaps.

 
Flag Post

Topic: Game Programming / Child Removing

How could that game have a few thousand objects?

 
Flag Post

Topic: Game Programming / Child Removing

How large does it have to get? For most project I don’t think there are huge memory leaks. I only find a need for like 5 nestings in a single project at most, and I don’t see any significant lag after long game play. Like… Project>Game>Map>Hero>Gun is the most I usually need.

 
Flag Post

Topic: Game Programming / Child Removing

Just remove Warrior class. You don’t need to disassemble your hierarchy system.

 
Flag Post

Topic: Game Programming / GotW #3 (China)

It looks like the GOTW is dying. Is anybody going to participate in this one?