Jump to content
  • Advertisement
Sign in to follow this  
Judah Smith

Array Problem: Flash AS2.0

This topic is 3772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to write my first game which is a mix of pong and breakout, the old Atari bat and ball game. Its been a helluva way to try to learn my first programming language and I've got a lot of learning from it. I have got the pong bit working but I'm struggling with the bricks on the breakout section. I decided that the best way to handle bricks is to hold them in an array (I need to learn arrays anyway) and I've gotten my bricks to form in a neat line, but I now need them to start a new line of bricks every time thay get to the edge of the screen (the stage height, my bricks run vertically). Is there anyone out there who I could send my code to, who could take a look and perhaps steer a n00b in the right direction? Many thanks

Share this post


Link to post
Share on other sites
Advertisement
var foo:Array = new Array();
var brickWidth:Number = 60;
var brickHeight:Number = 30;
var spacing:Number = 5;
var offsetX:Number = 0;
var offsetY:Number = 0;
for(int x = 0; x < width; ++x){
for(int y = 0; y < height; ++y){
foo.Push(new Brick(x*(brickWidth+spacing)+offsetX, y*(brickHeight+spacing)+offsetY));
}
}

That's one way to handle it. Are you using bitmap rendering?


http://www.kirupa.com/forum/showpost.php?p=2229691&postcount=9

follow that and use AS3 if you want to learn how to really handle games in flash. AS2 is kind of old.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!