Shooting multiple bullets

Hello everyone,
I'm trying to make my platform game character shoot a gun, my
character and gun are one movieclip and the bullet is another. The
bullet mc starts on a blank frame with a stop() function, when I
press the space bar the bullet mc plays from frame 2 which is a
motion tween of the bullet quickly moving across the page. I've set
the bullet's y and x values relative to the character mc so that
the bullet always comes from the gun.
My issue is that if I press the space bar a bullet will fly
out of the gun (great!) but if I press the space bar again, the
first bullet disappears and the bullet animation starts again. I
want to be able to shoot a new bullet every time I press the space
bar without effecting the bullets that have already been shot.
if(event.keyCode == Keyboard.SPACE)
bullet_right_mc.y = (ball_mc.y -38);
bullet_right_mc.x = (ball_mc.x + 253);
bullet_right_mc.gotoAndPlay("shoot");
Thanks
Ryan

You need to create new instances of the bullt for every use
of the spacebar. To do that you need to have the bullets called in
dynamically from the library.
First you need to designate the bullet mc in the library as
an item that can be loaded dynamically. Right click on it in the
library and select Linkage from the menu that appears. In the
interface that appears, select Export for Actionscript. A Class
name will automatically be assigned, which you can change as you
like (lets just say you name it Bullet). This is the name you will
use to call in the bullets.
When you click OK to close that interface, it will come up
with an indication saying it can't find the class so it will create
one... click OK there to.
Then, your code will become...
if(event.keyCode == Keyboard.SPACE)
var bullet:Bullet = new Bullet();
bullet.y = (ball_mc.y -38);
bullet.x = (ball_mc.x + 253);
this.addChild(bullet);
bullet.gotoAndPlay("shoot");
That code was quick and dirty, so it probably has an error or
two inherent, maybe the last line of it,
so if that fails you could replace it with
this.getChildAt(this.numChildren-1).gotoAndPlay("shoot");
that might fly
In any case, it will at least get you moving towards having
mutliple bullets flying. You can post again if you have a new
problem to solve.

Similar Messages

  • Firing multiple Bullets

    Hi,  I have written the code below which restricts the number of bullets fired, but each bullet fired travels at a different speed to the last and
    when another bullet is fired the previous one disappears from the screen. Please can anyone give any guidance ?
    import flash.display.MovieClip;
    import flash.events.KeyboardEvent;
    import flash.events.Event;
    import flashx.textLayout.formats.BackgroundColor;
    var speed:Number;
    speed = 10;
    var shootLimiter:Number=0;
    var backgrou:MovieClip = new Background();
    var bullet:MovieClip = new Bullet();
    addEventListener(Event.ENTER_FRAME,backgroundmove);
    backgrou.x =0;
    backgrou.y = 45;
    addChild(backgrou);
    var ship:MovieClip = new Ship();
    ship.x = 100;
    ship.y =200;
    addChild(ship);
    function backgroundmove(e:Event):void
    backgrou.x -= 1;
    shootLimiter++;
    if(backgrou.x < -2110)
    backgrou.x = 0;
    stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyDown);
    function KeyDown(event:KeyboardEvent):void
    if((event.keyCode == 32) &&(shootLimiter>16))
    AddBullet();
    if(event.keyCode == 37){  //checks if left arrowkey is released.
    ship.x -=5;
    shootLimiter++;
    if(event.keyCode == 39){  //checks if right arrowkey is released.
    ship.x +=5;
    shootLimiter++;
    if(event.keyCode == 38){  //checks if up arrowkey is released.
    ship.y -= 5;
    shootLimiter++;
    if(event.keyCode == 40){  //checks if down arrowkey is released.
    ship.y+= 5;
    shootLimiter++;
    function AddBullet()
    bullet.x = ship.x +100;
    bullet.y = ship.y + 30;
    addChild(bullet);
    shootLimiter=0;
    addEventListener(Event.ENTER_FRAME,movebullet);
    function movebullet(e:Event):void
         bullet.x += speed;
         if(bullet.x > 800)
             if(contains(bullet)){
               removeChild(bullet);
              removeEventListener(Event.ENTER_FRAME,movebullet);

    You only have one bullet:
    var bullet:MovieClip = new Bullet();
    adding child on it does not make a new one. You need something like:
    addChild(new Bullet());
    to make multiple bullets.
    In addition nested functions are a poor choice, you should remove moveBullet from inside of addBullet. The you probably want to make a bullet class that is linked to your library bullet clip - then bullets can move and remove themselves.

  • Same shooting, multiple lenses, how to apply the appropriate lens correction when importing ?

    Hello everyone,
    How do you handle this:
    For each camera, i have a default preset i'm choosing manualy and applying when importing my raw files into lightroom.
    I'd like to also add some default lens correction to those presets.
    The problem is that multiples lenses (meaning different corrections) may be applied.
    How to apply the correct lens correction for each file, in the batch import ?
    Thanks for your ideas ...
    Aymeric

    Update your existing develop presets so that the Lens Corrections are checked (see attached screen shot). Select the develop preset in Import dialog. Lr will automatically apply the appropriate default lens profile to each individual image during import.

  • Multiple bullet textboxes

    Hi I'm pretty new to Mac. I'm switching from MS PowerPoint to Keynote and I'm not able to create multiple textboxes for itemized paragraph in the same slide.
    When I already have 1 itemized textbox I create the second one, but I cannot create itemized text.
    I think this depends from the different structure of Keynote sfw.
    Can you help me?
    Thank you in advance
    Filippo

    Read the second post here:
    http://discussions.apple.com/thread.jspa?messageID=775679&#775679
    There used to be an FAQ for this, but Apple hasn't put them back after the change over with the forums.

  • Use mask to show one bullet point at a time

    I have content in multiple bullet points of text. The background is a texture. I'd like to use mask to show the text in sync with audio. It works but the text is the color of the mask. I have bullet point itself in a different color. How can I mask the area to show and use its own color?
    Or is there a better way to sync multiple bullet points of text without having each bullet points in its own layer and MC?
    Thanks,

    make sure your font is embedded.

  • Timer that "fires" multiple functions

    Hi all
    I really need a Timer that shoots multiple functions. The
    Timer Class just handles one function and therefore is not good
    enough for my project. The Timer should work something like this:
    After 1 seconds fire functionOne
    After 4 seconds fire functionTwo
    ...and so on...
    Time is really crucial in my project (down to milliseconds)
    so I really can´t use the Timer Class and fire "new" Timers
    all the time because Flash needs some milliseconds to process all
    the code and in the end it sums up to kind of a lot of time.
    I hope I have been clear enough.
    Any advices on how to do this?
    Regards
    //Leine

    Leine,
    > I really need a Timer that shoots multiple functions.
    The Timer
    > Class just handles one function and therefore is not
    good enough
    > for my project.
    The first thing that comes to mind is, use numerous
    instances of Timer.
    > Time is really crucial in my project (down to
    milliseconds) so I
    > really can?t use the Timer Class and fire "new" Timers
    all the
    > time because Flash needs some milliseconds to process
    all the code
    Aha. Then how about a single "master timer" that keeps track
    of a
    cumulative delay, using modulo to trigger separate functions?
    var cumulativeDelay:int = 0;
    var timer:Timer = new Timer(500, 0);
    timer.addEventListener(TimerEvent.TIMER, masterTimer);
    timer.start();
    function masterTimer(evt:TimerEvent):void {
    cumulativeDelay += 500;
    if (cumulativeDelay % 1000 == 0) trace("every second");
    if (cumulativeDelay % 2500 == 0) trace("every two and a half
    seconds");
    if (cumulativeDelay % 4000 == 0) trace("every four
    seconds");
    Not sure if that would be any more efficient than numerous
    instnaces,
    but worth a shot.
    David Stiller
    Co-author, ActionScript 3.0 Quick Reference Guide
    http://tinyurl.com/2s28a5
    "Luck is the residue of good design."

  • Nikon D800 Multiple Exposure problem in Aperture

    When I shoot multiple exposures with the new Nikon D800, import into Aperture (latest greatest version with all updates up-to-date) the image imported looks NOTHING like what was on the saved/merged image in-camera and appears red-red-red. Shot a bunch last night had issue with every one. Think there might be an overlooked glitch here. Everything else seems to work 100% with D800, but this might be glitch.
    So, I wanted to be sure I wasn't seeing things, took the camera to kid's soccer game today to further test, got home and loaded 'em into Aperture, same exact thing. The blown-out ones are the multiple exposures (look perfect in-camera) and as you can see the following photo is as it was shot (non-red ones to the right of the selected 5 that are blow-out examples.)

    I don't think it's magic dust and it's definitely been used for more than 100 years....there aren't Multiple photos, it's 1 photo exposed multiple times with and end net of 1 photo. This is NOT like HDR where you have multiple photos at different EV and merge, this is 1 photo and shutter actuated on SAME photo multiple times. In other words, there is no "series" of photos to look at....1 photo. Cannot understand why Aperture is having stuch a problem with this when it didn't have the problem with D700 files.
    Multiple Exposure Examples below.

  • Firing bullets in space invaders game

    hey guys,
    I am trying to work out the logic and the code required for firing a bullet in a space invaders style game.
    I have a space ship on a stage that moves around freely using the arrow keys and I want to use the space bar to release a bullet.
    So far my thinking is as follows:
    when the space bar is pressed a bullet is released from the players space ship.
    so I need to think about:
    - the speed of the bullet
    - the position of the spaceship when the bullet is fired
    - being able to fire multiple bullets one after the other
    - the bullet should move from the bottom of the screen to the top of the screen
    - the consequence of a bullet hitting a target
    I do not know how many scripts I would need to tackle this? how many behaviours per script and more importantly the code required....
    I am desperate for any help and support you can provide...
    thank you

    thank you for your support
    at this current time it would be a waste of time to understand how things work that did not benefit my game, sure knowledge would give me power but at the moment Id rather concentrate on gaining the appropriate knowledge as per the mechanics of my game and not going off in the opposite direction
    having had a look at your space invaders game and the code and logic you provided it is different to the game I am building because:
    - you use the move for movement and fire whereas I use cursor keys and a space bar
    - you have limited the amount of ammuntion, I have not
    - there are no explosions or changing of cast members on intersection.
    I understand the aim of you posting the guide however I am of the thinking it would be better to follow a tutorial that is in line with what I require rather then learning a particular style and then again having to work out how to amend it again to be used in my game...
    So if anyone can help me understand or provide code as per my initial message , I would be so grateful
    thank you

  • Multiple exposures DISABLE

    just bought a 6d. was shooting Multiple Exposures, then disabled it to shoot normal but the feature was not disabled. it still is shooting Multipe Exposures. feel trapped . help. how do i get out of it or is it a camera defect?
    thanks for any help
    tom
    Solved!
    Go to Solution.

    Are you talking about the multiple exposures mode that blends the photos together in-camera, or exposure bracketing where it takes 3 -7 photos consecutively, at different exposures, but leaves the files separate?
    If the latter, I've had similar problems before when I tried to turn it on/off and exited out of it without actually turning it on/off (user error).  I don't have my camera in front of me, but i was either not using the "set" button to confirm the setting, or I was and you don't have to.  I can't remember which, but it's simple enough to go back in and confrim.
    If the former, I can't say, I've never used that function.  Does the menu say "disable"?  If it really is stuck then you should try a factory reset.

  • Rotating guns and shooting them at the same time?

    I put the registration point as the gun's arms. So then the gun would rotate from the arms. But then the bullets come out from the registration point as well. So if I make the registration point on the barrel of the gun, the gun would rotate from the barrel and then shoot from the barrel. So I'm a bit confused where is the right place to place the registration point.
    Now what I want would be: Shooting the bullets from the barrel, not the arms. And also rotating by placing an axis on the arms, not the barrel. At the same time.
    I tried tweeking it like, bullet.x = x - 100 to make the bullet placed on the barrel and come out from there, but if i rotate let's say (180 degrees) it shoots from the from x - 100 but then the gun is on the other side, so the bullet wouldn't be coming out from the barrel anymore.
    I also tried tweeking it by adding a movieclip INSIDE the movieclip gun's barrel so the bullets would come from THAT location, but it shot bullets weirdly and not in the right position.
    here is my code, is there any modifications i can put? so it can shoot from the barrel regardless of rotating the gun and changing positions, and also rotate from the arms at the same time? if there is any other solution to tweek it, thanks a lot.
      function initialize(e:Event)
       //add a click listener to the stage
       stage.addEventListener(MouseEvent.CLICK, fire);
      function fire(m:Event)
       //spawn a bullet
       var b = new Bullet;
       //set the position and the rotation of the bullet
       b.rotation = rotation;
       b.x = x;
       b.y = y;
       //add the bullet to the parent object
       parent.addChild(b);
       //play the firing animation
       play();
      function update(e:Event)
       //make the gun face the mouse
       if (parent != null)
        var dx = parent.mouseX - x;
        var dy = parent.mouseY - y;
        var angle = Math.atan2(dy, dx)/Math.PI * 180
        rotation = angle;
    Thank you for reading, sorry if it was long.

    For some reason, the gun's bullets still come out from the registration point. The registration points are on the arms, the gun is facing right and the barrel is at the end of the right.
    But I tried this code but the bullet comes out from the same place of the rotating axis. I tried playing around with the code but no possible solutions.
    Thanks.
    EDIT: Also, if I put
    b.x=platform.x+Math.cos(gun.rotation*Math.PI/180)*gun.length;  // where platform is the parent of the gun (assuming your gun is attached to a platform like a tank).
    b.y=platform.y+Math.sin(gun.rotation*Math.PI/180)*gun.length;
    The bullet comes out from the platform's registration point. If I remove the platform part, it comes out from the gun's reg point.
    Another thing, if I modify it like "length - 100", it will change it's position but won't follow the rotation of the gun like I stated above. If it shoots from a certain location., and then I rotate the gun a certain amount of degrees the bullet will shoot from that side instead of following the gun's barrel.
    So I'm wasn't completely sure on how to fix this. Thanks again.

  • Adobe Bridge CS6 display question

    I am a landscape photographer.  Many times I shoot multiple exposures of the same scene to combine them later in HDR.  These are generally 3 or 5 exposures taken at the same time.  It would be very useful to see each set of multiple exposures on a separate line in Adobe Bridge so I can quickly choose which set to use for processing in HDR.  Does anybody know how to do that?  I could not see it in the View options in the menu bar of Bridge.  I am using Adobe Bridge CS6 (5.0.1.21) on MAC OSX 10.6.8. Any help is appreciated. Thank you.
    www.ajitphoto.com
    Sunnyvale, CA

    It would be very useful to see each set of multiple exposures on a separate line in Adobe Bridge so I can quickly choose which set to use for processing in HDR
    You can't do so in Bridge when having different amounts of series. If you shot always 5 you could drag the content window to a new size in combination with changing the thumbnail size so 5 thumbs would show in a row. The same with 3 but there is no way to have a content window showing 1 line with 3 and 1 line with 5 files in the same panel.
    In filmstrip mode you have 1 single line but that does not meet you wishes also.
    There is the option to auto stack for HDR or Photomerge (Stacks / Auto stack Panorama-HDR) but frankly spoken this sucks because it either does not do the job properly or simply crashes Bridge to my experience.

  • User cancelled request error

    Have a feeling this has been discussed before, but couldn't find anything that worked. When I try to start a video chat with a friend, I get the message that the user cancelled the request, even thought it was accepted. Both of us were able to successfully connect to the apple test video chat. We have port forwarded all the ports Apple reccommended, but still no luck. Anyone have any suggestions?
    My setup: 12inch ibook G4 with 768 megs of RAM
    Router setup is tricky: Linksys WIRED router connected to cable modem. From there I have a Netgear WIRELESS router plugged into the Linksys. My ibook uses wireless most of the time.
    I can get video chat no problem when I connect directly to the modem. Couldn't connect with just one router on the network (either one). The wired linksys is older, so I thought it may have been that, but the newer wireless router didn't work either.
    Anyone know what the specific router settings are supposed to be? I have applecare for the ibook and they said they couldn't help since it was a router issue. I thought good customer service would be helping the customer get their product working, but apparently not. Any help is appreciated!

      Hello Meghan. First, I suggest you and your chat buddies who use Tiger should consider the suggestions from Help for iChat AV 3 Problems that are relevant to your system(s?) to see if they resolve your problem.
    If they do not, both of you should test with several other users to find which system is causing the problem. Otherwise, both of you will need to troubleshoot everything.
    If you need more Buddy Names for iChat Test, you can get some here. I keep no regular hours, but I (or the others listed there) will be happy to test with you whenever our status shows green ("Available") in your Buddy List.
    The problem system should then consider the suggestions in Using iSight with iChat AV.
    Among the suggestions there are tips on trouble shooting multiple devices as well as links to info about router configuration. Having tested with only one router in the loop, you have a good start on that, but you may need the additional suggestions, too.
    (You do not specifically say so, but I assume here that you are using iChat AV as your video chat app.) Use of multiple routers with iChat AV may require additional configuration settings. iChat AV can deal with only ONE device acting as a DHCP server. Therefore, I suggest that you only use one router if you can operate in that way.
    If you MUST use two routers for some reason, DHCP serving MUST be disabled (turned off) on one of the routers so only ONE of them is serving DHCP. The best way to do this is to enable "bridge mode" in one router. The instructions for doing this are in your router's users manual.
    If you are using multiple routers because you have several computers, game boxes, VOIP devices, etc., connected to your internet service, you should Check your Broadband Speed.
    Just FYI, I (and many other users) need NO port configuration of any kind to make iChat Video work. I have my Mac OS X software firewall enabled at all times and use a wireless router that is in current production. I make NO manual port configuration settings in either component.
    If you must make manual port configuration setting to make your system work, pay particular attention to the router suggestions from Ralph Johns that are linked in "Using iSight with iChat AV." Ralph also explains the error in Apple's Technical Article #93208. Carefully double check all settings and changes that you have made against Ralph's info. That should get you going if your problem is related to port configuration.

  • Stacks and exporting to Flickr

    I'm fairly sure this is pilot error, but I can't see where I'm going wrong...first, let me describe what I want to do.
    I have a RAW image called "A.NEF" (Nikon D300 RAW). I want to edit it externally in CS5 (could be any editor). When it comes back to Aperture, I now have a file called A.TIF. I really want those to be stacked together - sometimes I shoot multiple images of the same thing (different settings, etc.), so I might have "A", "B", "C", etc. It's really important for me to know that the TIF file came from "A". By the way, I end up having to change the version name for A.TIF because otherwise, it gets posted to Flickr as A.TIF instead of a 'real' name.
    So - I stack A.NEF and A.TIF. Great. I have Aperture set up to sync to Flickr, and I created an album called "Aperture Uploads". I highlight A.TIF and drag it into the "Aperture Uploads" album. Now, here is where the crushing disappointment begins... :-((
    It ends up dragging the entire stack into the album, not just the one I had highlighted. This means that the original A.NEF and the A.TIF both get uploaded to Flickr. I've also found some odd behavior here - sometimes both of them get uploaded, sometimes it's only one, but there's no consistency.
    Can I stack pictures yet still drag a single image from the stack into a Flickr album?

    I've had this problem as well, and have basically given up on using the Flickr or Facebook built-in exporting. I know this doesn't answer your question, but I just export to my desktop, then upload those to Flickr, Picassa, Facebook or whatever from there.
    It seems when I had Flickr and Facebook photo albums in Aperture, they were constantly being updated when nothing had changed on those pictures, and continued even after I found and unchecked the "Automatically check for new published albums" the preferences.
    Good luck!
    Jeff

  • 18 Reasons for choosing the BlackBerry Z10 over i-phone 5

    Z10
    vs
    i- phone 5
    Has a video light
    Yes
    vs
    No
    A video light helps when recording a movie in low-light situation like a party.
    CPU
    Faster CPU clock speed
    2x 1.5 GHz
    vs
    2x 1.3 GHz
    15.38% faster CPU clock speed.
    DISPLAY
    A little bigger screen size
    4.2"
    vs
    4"
    5% bigger screen size. The bigger the screen size is, the better the user experience.
    A little bit higher pixel density
    356 ppi
    vs
    326 ppi
    9.2% higher pixel density.
    Higher resolution
    768 x 1280 px
    vs
    640 x 1136 px
    35.21% higher resolution.
    MEMORY
    Heaps more RAM memory
    2 GB
    vs
    1 GB
    1 GB more RAM memory.
    POWER
    Can be charged via standard USB cable
    Yes
    vs
    No
    It can be charged and operated with a standard USB cable with your computer or with USB power supplies.
    More battery power
    1,800 mAh
    vs
    1,440 mAh
    25% more battery power.
    Has a removable battery
    Yes
    vs
    No
    The battery is removable and can be replaced by the user if broken
    OS
    Plays Adobe Flash
    Yes
    vs
    No
    Adobe Flash with Video and Sound is supported in the device's browser.
    LENS
    Appreciably wider aperture
    f/2.2
    vs
    f/2.4
    8.33% wider aperture. The wider an aperture, the more light the image sensor gets. More light helps avoiding blur by employing a faster shutter speed. Aperture sizes are expressed in f-stops, the smaller the better. In addition, wide lenses provide a narrow depth of field enabling to focus on the subject and blur the background.
    CAMERA
    Has manual focus
    Yes
    vs
    No
    This allows to manually set the focus.
    Has a serial shot mode
    Yes
    vs
    No
    You can shoot multiple pictures in a row.
    Considerably more megapixel (photo, front camera)
    2 MP
    vs
    1.2 MP
    1.67x more megapixel (photo, front camera).
    CONNECTIVITY
    Has NFC
    Yes
    vs
    No
    Near-field-communication (NFC) allows wireless transactions like payments.
    Has an external memory slot
    Yes
    vs
    No
    The device has a standardized external memory slot in order to easily extend the internal storage with affordable memory modules which can be SD slot, microSD slot, etc.
    Has USB mass storage support
    Yes
    vs
    No
    It can transfer files, music, photos via USB, no need to install additional software.
    Has an HDMI output
    Yes
    vs
    No
    Video and movies can be watched on a TV with HDMI input.

    I agree with everything except the CPU comparison.
    Comparing CPUs is relevant only with all other things identical.
    on the other hand, comparing a CPU with BlackBerry10 on one side and iOS on the other side is not relevant.
    What matters is that BlackBerry10 is multitask, meaning better battery management.
    The search box on top-right of this page is your true friend, and the public Knowledge Base too:

  • TypeError: Error

    I have no idea what is wrong, I have checked for typos and everything else I can think of.
    The game needs to be handed in tomorrow so help is appreciated!
    These are the two errors I receive
    at Shooter_fla::MainTimeline/moveEnemy()[Shooter_fla.MainTimeline::frame1:263]
    at Shooter_fla::MainTimeline/Movement()[Shooter_fla.MainTimeline::frame1:83]
    //Imports (these will often be created for you when required)
    import flash.events.KeyboardEvent;
    import flash.events.MouseEvent;
    //Event Listeners (trigger specific functions)
    stage.addEventListener(KeyboardEvent.KEY_DOWN, ControlDown);
    stage.addEventListener(KeyboardEvent.KEY_UP, ControlUp);
    stage.addEventListener(Event.ENTER_FRAME, Movement);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, shoot2);
    stage.addEventListener(MouseEvent.MOUSE_UP, shoot);
    //Properties (Variables & Constants)
    var forward:Boolean = false;
    var left:Boolean = false;
    var right:Boolean = false;
    var back:Boolean = false;
    var shots:Array = [];
    var characterAngle:Number = char_mc.rotation * Math.PI / 180;
    var spaceBar:Boolean = false;
    var bulletSpeed:int = 7;
    var movementspeed:int = 4;
    var timer:int = 20;
    var mousedown:Boolean = false;
    var enemies:Array = [];
    var score:int = 0;
    var lives:int = 3;
    Score_mc.Score_txt.text = String(score);
    Score_mc.Lives_txt.text = String(lives);
    //make the EndGame symbol invisible
    GameOver_mc.visible = false;
    Mouse.hide();
    //This function deals with keyboard controls;
    function Movement(event:Event):void
      if (forward)
      char_mc.y -=  movementspeed;
      if (back)
      char_mc.y +=  movementspeed;
      if (left)
      char_mc.x -=  movementspeed;
      if (right)
      char_mc.x +=  movementspeed;
      if (mousedown)
      if (timer <= 0)
      timer = 20;
      addBullet(char_mc.x, char_mc.y, char_mc.rotation);
      char_mc.rotation = -(Math.atan2(char_mc.x - mouseX, char_mc.y - mouseY) * 180 / Math.PI)  -90;
      crosshair.x = mouseX;
      crosshair.y = mouseY;
      timer--;
      bulletAction();
      addEnemy();
      moveEnemy();
      hitEnemy();
    function ControlDown(event:KeyboardEvent):void
      switch (event.keyCode)
      case 87 :
      forward = true;
      break;
      case 65 :
      left = true;
      break;
      case 68 :
      right = true;
      break;
      case 83 :
      back = true;
      break;
      case Keyboard.SPACE :
      spaceBar = true;
      break;
    function ControlUp(event:KeyboardEvent):void
      switch (event.keyCode)
      case 87 :
      forward = false;
      break;
      case 65 :
      left = false;
      break;
      case 68 :
      right = false;
      break;
      case 83 :
      back = false;
      break;
      case Keyboard.SPACE :
      spaceBar = false;
      break;
    function shoot2(e:MouseEvent):void
      mousedown = true;
    function shoot(e:MouseEvent):void
      mousedown = false;
    function addBullet(startX, startY, rot):void
      var s:Shot = new Shot();
      s.x = startX;
      s.y = startY;
      s.rotation = rot;
      //add the new shot to the stage
      stage.addChild(s);
      //store the object in an array
      shots.push(s);
    function bulletAction():void
      for (var i:int = 0; i <= shots.length - 1; i++)
      shots[i].x +=  bulletSpeed * Math.cos(shots[i].rotation * Math.PI / 180);
      shots[i].y +=  bulletSpeed * Math.sin(shots[i].rotation * Math.PI / 180);
      if (shots[i].x > stage.stageWidth ||shots[i].y > stage.stageHeight || shots[i].x < 0 || shots[i].y < 0)
      stage.removeChild(shots[i]);
      shots.splice(i, 1);
    function addEnemy():void
      //limit number of enemies on screen
      if (enemies.length < 3
      //declare an object instance from the enemy Class
      var e:Enemy = new Enemy();
      //set the enemy start point to the far right of the stage
      var startX:int = Math.random() * stage.stageWidth;
      //Randomise where the enemy starts on the right
      var startY:int = Math.random() * stage.stageHeight;
      //set the new bullet's x,y coordinates
      e.x = startX;
      e.y = startY;
      //add the new enemy to the stage
      stage.addChild(e);
      //store the object in an array
      enemies.push(e);
    function moveEnemy():void
      //loop through all instances of the enemy
      //loop from '0' to 'number_of_enemies'
      for (var i:int = 0; i <= enemies.length - 1; i++)
      //if the enemy is below the ship then move up
      if (enemies[i].y > char_mc.y)
      enemies[i].y -=  1;
      //else if the enemy is above the ship then move down
      else if (enemies[i].y < char_mc.y)
      enemies[i].y +=  1;
      //if the enemy is below the ship then move up
      if (enemies[i].x > char_mc.x)
      enemies[i].x -=  1;
      //else if the enemy is above the ship then move down
      else if (enemies[i].x < char_mc.x)
      enemies[i].x +=  1;
      //if enemy hits the player's ship
      if (enemies[i].hitTestObject(char_mc))
      //remove the enemy from the stage
      stage.removeChild(enemies[i]);
      //remove the enemy from the array
      enemies.splice(i, 1);
      lives -=  1;
      Score_mc.Lives_txt.text = String(lives);
      if (lives <= 0)
      //remove event listeners to cease all actions on stage
      stage.removeEventListener(KeyboardEvent.KEY_DOWN, ControlDown);
      stage.removeEventListener(KeyboardEvent.KEY_UP, ControlUp);
      stage.removeEventListener(Event.ENTER_FRAME, Movement);
      stage.removeEventListener(MouseEvent.MOUSE_DOWN, shoot2);
      stage.removeEventListener(MouseEvent.MOUSE_UP, shoot);
      //remove bullets (as these will appear...
      //...in front of our EndGame symbol)
      for (var j:int = 0; j <= shots.length - 1; j++)
      stage.removeChild(shots[j]);
      //remove enemies (as these will appear...
      //...in front of our EndGame symbol)
      for (var k:int = 0; k <= enemies.length - 1; k++)
      stage.removeChild(enemies[k]);
      //set final score
      GameOver_mc.FinalScore_txt.text = String(score);
      //show EndGame symbol
      GameOver_mc.visible = true;
    function hitEnemy():void
      //loop through all bullets...
      for (var i:int = 0; i <= shots.length - 1; i++)
      //...and loop through all enemies for each bullet
      for (var j:int = 0; j <= enemies.length - 1; j++)
      //check each bullet against each enemy for hits
      if (shots[i].hitTestObject(enemies[j]))
      //remove the bullet and enemy from the stage
      stage.removeChild(shots[i]);
      stage.removeChild(enemies[j]);
      //remove the bullet and enemy from their arrays
      shots.splice(i, 1);
      enemies.splice(j, 1);

    your errors are on lines 83 and 263.
    what are those lines and what are the error messages?

Maybe you are looking for

  • Opening PDF Files with Adobe Reader XL

    I use Google Chrome & have the latest version of Adobe Reader XL installed buyt cannot open any of my PDF files & Windows reverts me to a box that wants to search for other programs that opens PDF files. This all began a few months ago because I used

  • Timeout waiting for ARP/RARP packets

    I am installing Solaris 8 for the first time on an Ultra 5. It has a network card and attached to my 10mbps Hub which is connected to Cable Modem. Problem: While the system was rebooting after the install, the system generated the error trying to lin

  • Running 100 percent of cpu

    My Itunes is taking 100 percent of the CPU. Any help ?

  • How to remove ghost images in Captivate 7?

    Our company recently upgraded us from Captivate 4 to 7. In doing a software simulation, I have noticed that ghost lines appear as the previous screen transitions into the next -- particularly when scrolling -- and doesn't appear until it's in the bro

  • Download site down

    I am trying to download oracle 10g JDBC driver jar, but I am unable to. Is the download site down? All the lonks on the internet point to the same URL.