Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8263669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:11:14+00:00 2026-06-08T04:11:14+00:00

I’m making a Bubble shooter game in ActionScript 3.0 and I’m having trouble placing

  • 0

I’m making a Bubble shooter game in ActionScript 3.0 and I’m having trouble placing the bubbles right. It should look something like this:

00000000
 00000000
00000000
 00000000

but I’m only placing the first and the third row at the moment and I don’t know what I’m doing wrong.. Here is my code so far:

bubble_mc: (which is my bubbles, there’s 6 different bubbles)

package  {
    import flash.display.MovieClip;
    public class bubble_mc extends MovieClip {
        public function bubble_mc(val:uint,row:uint,col:uint) {
            gotoAndStop(val+1);
            name=row+"_"+col;
            x=50+col*36;
            y=40+row*36;
        }

    }

}

Main:

package  {
    import flash.display.Sprite;
    import flash.events.KeyboardEvent;
    import flash.events.Event;
    public class Main extends Sprite {
        private const ROT_SPEED:uint=2;
        private const R:uint=18;
        private const D:Number=R*Math.sqrt(3);
        private var bubbleArr:Array=new Array();
        private var cannon:cannon_mc;
        private var bubble:bubble_mc;
        private var left:Boolean=false;
        private var right:Boolean=false;
        private var bubCont:Sprite;
        public function Main() {
            placeContainer();
            placeCannon();
            stage.addEventListener(KeyboardEvent.KEY_DOWN,onKDown);
            stage.addEventListener(KeyboardEvent.KEY_UP,onKUp);
            addEventListener(Event.ENTER_FRAME,onEFrame);
        }
        private function placeCannon():void {
            cannon=new cannon_mc();
            addChild(cannon);
            cannon.y=385.5;
            cannon.x=320;
        }
        private function onKDown(e:KeyboardEvent):void {
            switch(e.keyCode) {
                case 37 :
                    left=true;
                    break;
                case 39 :
                    right=true;
                    break;
            }
        }
        private function onKUp(e:KeyboardEvent):void {
            switch(e.keyCode) {
                case 37 :
                    left=false;
                    break;
                case 39 :
                    right=false;
                    break;
            }
        }
        private function onEFrame(e:Event):void {
            if (left) {
                cannon.rotation-=ROT_SPEED;
            }
            if (right) {
                cannon.rotation+=ROT_SPEED;
            }
        }
        private function placeContainer():void {
            bubCont=new Sprite();
            addChild(bubCont);
            bubCont.graphics.lineStyle(1,0xffffff,1);
            for (var i:uint=0; i<4; i++) {
                if (i%2==0) {
                    for (var j:uint=0; j<15; j++) {
                        bubbleArr[i]=new Array();
                        bubbleArr[i][j]=Math.floor(Math.random()*6);
                        bubble = new bubble_mc(bubbleArr[i][j],i,j);
                        bubCont.addChild(bubble);
                    }
                } else {
                        if (j<14) {
                            bubbleArr[i][j]=Math.floor(Math.random()*6);
                            bubble = new bubble_mc(bubbleArr[i][j],i,j);
                            bubble.x=68+i*36;
                            bubCont.addChild(bubble);
                        }
                }
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:11:15+00:00Added an answer on June 8, 2026 at 4:11 am

    I have solved it! In case someone has the same problem, here is the code i solved it with! (The changes I have made to x-coordinates doesnh’t matter..)

    bubble_mc:

    package  {
        import flash.display.MovieClip;
        public class bubble_mc extends MovieClip {
            public function bubble_mc(val:uint,row:uint,col:uint) {
                gotoAndStop(val+1);
                name=row+"_"+col;
                x=59+col*36;
                y=40+row*36;
            }
        }
    }
    

    Main

    package  {
        import flash.display.Sprite;
        import flash.events.KeyboardEvent;
        import flash.events.Event;
        public class Main extends Sprite {
            private const ROT_SPEED:uint=2;
            private const R:uint=18;
            private const D:Number=R*Math.sqrt(3);
            private var bubbleArr:Array=new Array();
            private var cannon:cannon_mc;
            private var bubble:bubble_mc;
            private var left:Boolean=false;
            private var right:Boolean=false;
            private var bubCont:Sprite;
            public function Main() {
                placeContainer();
                placeCannon();
                stage.addEventListener(KeyboardEvent.KEY_DOWN,onKDown);
                stage.addEventListener(KeyboardEvent.KEY_UP,onKUp);
                addEventListener(Event.ENTER_FRAME,onEFrame);
            }
            private function placeCannon():void {
                cannon=new cannon_mc();
                addChild(cannon);
                cannon.y=385.5;
                cannon.x=320;
            }
            private function onKDown(e:KeyboardEvent):void {
                switch(e.keyCode) {
                    case 37 :
                        left=true;
                        break;
                    case 39 :
                        right=true;
                        break;
                }
            }
            private function onKUp(e:KeyboardEvent):void {
                switch(e.keyCode) {
                    case 37 :
                        left=false;
                        break;
                    case 39 :
                        right=false;
                        break;
                }
            }
            private function onEFrame(e:Event):void {
                if (left) {
                    cannon.rotation-=ROT_SPEED;
                }
                if (right) {
                    cannon.rotation+=ROT_SPEED;
                }
            }
            private function placeContainer():void {
                var iRow:Boolean=false;
                bubCont=new Sprite();
                addChild(bubCont);
                bubCont.graphics.lineStyle(1,0xffffff,1);
                for (var i:uint=0; i<4; i++) {
                    if (! iRow) {
                        for (var j:uint=0; j<15; j++) {
                            bubbleArr[i]=new Array();
                            bubbleArr[i][j]=Math.floor(Math.random()*6);
                            bubble = new bubble_mc(bubbleArr[i][j],i,j);
                            bubCont.addChild(bubble);
                            iRow=true;
                        }
                    } else {
                        for (j=0; j<15; j++) {
                            bubbleArr[i]=new Array();
                            bubbleArr[i][j]=Math.floor(Math.random()*6);
                            bubble = new bubble_mc(bubbleArr[i][j],i,j);
                            bubble.x=77+j*36;
                            bubCont.addChild(bubble);
                            iRow=false;
                        }
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.