# \[AS2\] I need some assitance on PongOut modifications!

**URL:** <https://forum.kirupa.com/t/as2-i-need-some-assitance-on-pongout-modifications/260860>\
**Category:** flash\
**Created:** [May 20, 2008, 3:04pm UTC](https://forum.kirupa.com/t/as2-i-need-some-assitance-on-pongout-modifications/260860 "2008-05-20T15:04:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![someoneAnyone](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@someoneAnyone](https://forum.kirupa.com/u/someoneAnyone)\
**Post date:** [May 20, 2008, 3:04pm UTC](https://forum.kirupa.com/t/as2-i-need-some-assitance-on-pongout-modifications/260860/1 "2008-05-20T15:04:15Z")

</div>

I’m trying to make the PongOut game seen in the tutorials section completely code driven and dynamic based on the stage size. I doing this to learn more about class programming and programmatic animation.

I’ve managed to create a few routines… 1 can draw a simple circle, and the other can draw a rectangle. I’ve also modified the code so that the bricks are contained within the Arena that way I can control the entire games position, but I’m still seeing problems with how the bricks are layed out.

```auto
Game.prototype.drawArena = function() {
trace("DrawArea method called");
var Arena = this.timeline.createEmptyMovieClip("Arena", 0);
Arena.drawRectangle(Stage.width/2,Stage.height/2,this.right,this.down,xCCCCCC,1,0x000000,100);
Arena._x = Stage.width/2-Arena._width/2;
Arena._y = Stage.height/2-Arena._height/2;
};

```

The code above seems to work ok. I can draw the game board and center it.

```auto

Game.prototype.initBall = function() {
trace("initBall called");
var ball:MovieClip = this.timeline.createEmptyMovieClip("ball", 1);
ball.drawSimpleCircle(this.barLevel._x,this.barLevel,this.rLength,this.circleColor,this.circleAlpha);
}

```

I can draw the ball but the registration point seems to be messed up… can ideas on how to fix?

```auto
Game.prototype.initBricks = function(myMap) {
brick_mc = this.timeline.Arena.createEmptyMovieClip("brick_board", 1);
//bar_mc = brick_mc.createEmptyMovieClip("brick", 1);
//bar_mc.drawRectangle(0,0,15,20,xCCCCCC,1,0x000000,100);

trace("initBricks = "+brick_mc+" & "+bar_mc);

// size of the bricks
var h = Arena._height/10;
var w = Arena._width/5;
var c = 0;
for (var i in myMap) {
    for (var j in myMap*) {
        if (myMap*[j] != 0) {
            var cl = brick_mc.attachMovie("brick", "b"+c, c);
            trace(cl);
            cl._height = h;
            cl._width = w;
            cl._x = j*w+w;
            cl._y = i*h+h;
            cl.life = myMap*[j];
            c++;
        }
    }
    brick_mc._x = 0;
    brick_mc._y = 0;
}
};

```

I’m having problems with getting the bricks drawn into the Arena and control the size. I’m also at a loss as to how get a dynamically created clip placed on to the stage.

Ultimately I’d like to have nothing in my library and have it completely customizable via code. Can someone lend a hand?
