Add score to the shooting game

I'm looking to have a "partition" funtion added to my shooting game.  Have started to implement the code, I'm having problems to make it work.  The score will show early in the game, but then it disappears when I click on one of the ships.  Can someone help me?  I know this is a noob question but I am a beginner in Flash


Here is my flash file.  http://www.megaupload.com/?d=TPPUGS7Q

Thank you

trace() is a basic tool for the design/troubleshooting, you must learn to use.  It allows you to see the State of things (variable, etc.) at different stages of transformation.  For example, in your code, you can check to make sure that the value of score changes whenever you adjust it.

trace (_root.score);

And if the textfield in frame 2 is one that does not appear, do not use the appearance of the var, name the textfield instance (tFieldName used here as an example) and assigned the partition using...

tFieldName.text = _root.score;

and also have a trace (_root.score); If necessary to see if the value has brought in this framework.

Tags: Adobe Animate

Similar Questions

  • Problem of scope in the shooting game

    Hi I am trying to create a simple shooting game where a ship hit several asteroids without using classes and tables. I have

    get problems with the scope of variables--in this case error: asteroid asteroid of the undefined property. Can someone offers

    a tweek that I could use to solve this problem?

    Thanks for looking

    import of important flash libraries.
    import flash.events.KeyboardEvent;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.display.Sprite;

    var speed: Number = 10;
    Initializes the variables.
    var key_left:Boolean = false;
    var key_right:Boolean = false;
    var key_up:Boolean = false;
    var key_down:Boolean = false;
    var key_space:Boolean = false;
    var shootLimiter:Number = 0;
    Checks if the player presses a button.

    var: timer = new Timer(2000, 10);
    timer.addEventListener (TimerEvent.TIMER, AddAsteroid);
    Timer.Start ();

    stage.addEventListener (KeyboardEvent.KEY_DOWN, KeyDown);
    stage.addEventListener (KeyboardEvent.KEY_UP, KeyUp);

    var sprite: MovieClip = new Sprite()
    var backgr:MovieClip = new Background();

    backgr.x = 0;
    backgr.y = 45;
    addChild (backgr);
    addChild (sprite);

    function AddAsteroid(e:TimerEvent):void
    {

    var asteroid: MovieClip = new Asteroid();
    addChild (asteroid);
    Asteroid.x = 800;
    Asteroid.y = Math.round (Math.random () * 700);
    asteroid.addEventListener (Event.ENTER_FRAME, asteroidmove);


    function asteroidmove(e:Event):void
    {
    Asteroid.x-

    }
    }
    addEventListener (Event.ENTER_FRAME, backgroundmove);

    function backgroundmove(e:Event):void
    {
    backgr.x-= 1;

    If (backgr.x <-2110)
    {
    backgr.x = 0;
    }

    }



    Allows the main function play each image.
    addEventListener (Event.ENTER_FRAME, Main);

    Create the main function.
    main function (event: Event) {}
    CheckKeys();
    }

    Create the function KeyDown.
    function KeyDown(event:KeyboardEvent) {}
    if(Event.keycode == 37) {//checks if left arrowkey is pressed.
    key_left = true;
    }
    if(Event.keycode == 39) {//checks if right arrowkey is pressed.
    key_right = true;
    }
    if(Event.keycode == 38) {//checks if some arrowkey is pressed.}
    key_up = true;
    }
    if(Event.keycode == 40) {//checks if the arrowkey is pressed.
    Key_Down = true;
    }
    if(Event.keycode == 32) {//checks if the arrowkey is pressed.
    key_space = true;

    }
    }

    function KeyUp(event:KeyboardEvent) {}
    if(Event.keycode == 37) {//checks if left arrowkey is released.
    key_left = false;
    }
    if(Event.keycode == 39) {//checks if right arrowkey is released.
    key_right = false;
    }
    if(Event.keycode == 38) {//checks if some arrowkey is released.}
    key_up = false;
    }
    if(Event.keycode == 40) {//checks if the arrowkey is released.
    Key_Down = false;
    }
    if(Event.keycode == 32) {//checks if the arrowkey is released.
    key_space = false;
    }
    }

    function CheckKeys()
    {
    shootLimiter += 1;

    If (key_left)
    {
    setDirection (1);
    Sprite.x-= 5;
    }
    If (key_right)
    {
    setDirection (0);
    Sprite.x += 5;

    }
    {if (key_up)}
    Sprite.y-= 5;
    }
    {if (Key_Down)}
    Sprite.y += 5;
    }

    If ((key_space) & & (shootLimiter > 8))
    {
    shootLimiter = 0;
    var b = new Bullet();
    addChild (b);
    b.x = sprite.x + 50;
    b.y = sprite.y + 3;
    addEventListener (Event.ENTER_FRAME, moveBullet);
    }



    function moveBullet(e:Event):void
    {
    b.x += 10;

    If (b.x > 600)
    {
    If (Contains (b))
    {
    removeChild (b);
    }
    removeEventListener (Event.ENTER_FRAME, moveBullet);

    }

    If (b.hitTestObject (Asteroid))
    {
    removeChild (asteroid);
    removeChild (b);
    removeEventListener (Event.ENTER_FRAME, moveBullet);
    }
    }
    }
    function setDirection (param) {}
    If (param == 0) {}

    sprite.scaleX = 1;
    } else {}
    sprite.scaleX = - 1;
    }

    }

    You seem to be stating your asteroid inside a function, but try to access outside this function elsewhere.  When you declare an instance inside a function, he only carried within this function.

    You will probably also coax wrath of the compiler with a line like the following...

    var sprite: MovieClip = new Sprite();

  • Number of Collisions in the shooting game problem

    Hello, I work a simple game in which a ship fires at the approach of asteroids, and I have problems with the collision between the ship and the

    asteroid. In the movieClipI ship made incandescent chassis 6 to mean the 3 first collisions and the loss of life, and then for the fourth collision I have

    made an alpha of the 87 frame interpolation inside the boat so that he disappeared to signify the end of the game. I used a meter as shown below but all the ship

    fact is never gets so glow frame 87. Thank you for taking the time to see it.

    import of important flash libraries.
    import flash.events.KeyboardEvent;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.display.Sprite;

    var countCollisions:Number = 0;
    var astArray:Array = new Array();
    var speed: Number = 10;
    Initializes the variables.
    var key_left:Boolean = false;
    var key_right:Boolean = false;
    var key_up:Boolean = false;
    var key_down:Boolean = false;
    var key_space:Boolean = false;
    var shootLimiter:Number = 0;
    Checks if the player presses a button.

    var: timer = new Timer(2000, 10);
    timer.addEventListener (TimerEvent.TIMER, AddAsteroid);
    Timer.Start ();

    stage.addEventListener (KeyboardEvent.KEY_DOWN, KeyDown);
    stage.addEventListener (KeyboardEvent.KEY_UP, KeyUp);

    var ship: MovieClip = new Ship()
    var backgr:MovieClip = new Background();

    backgr.x = 0;
    backgr.y = 45;
    addChild (backgr);
    addChild (ship);

    function AddAsteroid(e:TimerEvent):void
    {

    var asteroid: MovieClip = new Asteroid();
    Asteroid.x = 800;
    Asteroid.y = Math.round (Math.random () * 700);
    astArray.push (asteroid);
    addChild (asteroid);
    asteroid.addEventListener (Event.ENTER_FRAME, asteroidmove);

    function asteroidmove(e:Event):void
    {
    Asteroid.x-
    ///

    ///

    for (var i = 0; i < astArray.length; i ++)
    {

    If (astArray [i] .hitTestObject (Ship))
    {
    countCollisions ++;
    ship.gotoAndPlay (6).

    if(countCollisions ==4)
    {
    ship.gotoAndPlay (87);
    }
    If (astArray [i] .stage)
    {
    removeChild (astArray [i]);
    removeEventListener (Event.ENTER_FRAME, asteroidmove);
    }


    }
    }

    }

    }

    addEventListener (Event.ENTER_FRAME, backgroundmove);

    function backgroundmove(e:Event):void
    {
    backgr.x-= 1;

    If (backgr.x <-2110)
    {
    backgr.x = 0;
    }
    }

    Allows the main function play each image.
    addEventListener (Event.ENTER_FRAME, Main);

    Create the main function.
    main function (event: Event) {}
    CheckKeys();
    }

    Create the function KeyDown.
    function KeyDown(event:KeyboardEvent) {}
    if(Event.keycode == 37) {//checks if left arrowkey is pressed.
    key_left = true;
    }
    if(Event.keycode == 39) {//checks if right arrowkey is pressed.
    key_right = true;
    }
    if(Event.keycode == 38) {//checks if some arrowkey is pressed.}
    key_up = true;
    }
    if(Event.keycode == 40) {//checks if the arrowkey is pressed.
    Key_Down = true;
    }
    if(Event.keycode == 32) {//checks if the arrowkey is pressed.
    key_space = true;

    }
    }

    function KeyUp(event:KeyboardEvent) {}
    if(Event.keycode == 37) {//checks if left arrowkey is released.
    key_left = false;
    }
    if(Event.keycode == 39) {//checks if right arrowkey is released.
    key_right = false;
    }
    if(Event.keycode == 38) {//checks if some arrowkey is released.}
    key_up = false;
    }
    if(Event.keycode == 40) {//checks if the arrowkey is released.
    Key_Down = false;
    }
    if(Event.keycode == 32) {//checks if the arrowkey is released.
    key_space = false;
    }
    }

    function CheckKeys()
    {
    shootLimiter += 1;

    If (key_left)
    {
    setDirection (1);
    Ship.x-= 5;
    }
    If (key_right)
    {
    setDirection (0);
    Ship.x += 5;

    }
    {if (key_up)}
    Ship.y-= 5;
    }
    {if (Key_Down)}
    Ship.y += 5;
    }

    If ((key_space) & & (shootLimiter > 8))
    {
    shootLimiter = 0;
    var b = new Bullet();
    addChild (b);
    b.x = ship.x + 50;
    b.y = ship.y + 3;
    addEventListener (Event.ENTER_FRAME, moveBullet);
    }

    function moveBullet(e:Event):void
    {
    b.x += 10;

    If (b.x > 600)
    {
    If (Contains (b))
    {
    removeChild (b);
    }
    removeEventListener (Event.ENTER_FRAME, moveBullet);

    }
    for (var i = 0; i < astArray.length; i ++)
    {
    If (astArray [i] .hitTestObject (b))
    {
    removeChild (b);
    removeChild (astArray [i]);

    removeEventListener (Event.ENTER_FRAME, moveBullet);
    }
    }
    }
    }
    function setDirection (param) {}
    If (param == 0) {}

    ship.scaleX = 1;
    } else {}
    ship.scaleX = - 1;
    }

    }

    You're a little around with it and you have not yet removed the asteroid of the table... see if what follows helps to resolve the issues...

    for (var i = 0; i)

    {if (astArray [i] .hitTestObject (Ship))}

    get rid of the asteroid
    MovieClip(astArray[i]).removeEventListener (Event.ENTER_FRAME, asteroidmove);
    removeChild (astArray [i]);
    astArray.splice (i, 1);
      
    countCollisions ++;
     
    If (countCollisions > = 4) {}
    ship.gotoAndPlay (87);
    } else {}
    ship.gotoAndPlay (6).
    }
    }

    }

  • someone at - it an idea on how I can get counter strike so run faster on my pc and not so little = specific, is the first person shooting game and not looking to spend money? Please and thank you!

    someone at - it an idea on how I can get counter strike so quickly on my pc and not so fragmentary and lag., is the first person shooting game and not looking to spend money?  someone help me please! and thank you!

    # You have not given any information, except for what you are trying to run.

    As far we know you run with some processors Sempron/Celeron and 512 MB shared memory with an on-board video camera.  In addition, you might have a suite of protection oversized running on your system to keep you safe from Internet predators and a bunch of other things you love continues to run in the background.

    Here again, you can have a dual core or higher processor 1.8 GHz or more fast speed with 1 GB or more of memory and a 512 MB or higher video card (do not share memory with the system) which has installed the most recent drivers.  Also you can have only a basic product antivirus running, by using the built-in Windows Firewall and you want to keep your system with as little as possible run so that most of your resources are available.

    Probable - in any case - other than generalities such as:

    (1) make sure that few runs when you play the game (with the exception of the game) as possible.
    (2) make sure that you have the latest video card driver installed for your video card.
    (3) make sure that you have the latest driver installed for your motherboard chipset.
    (4) make sure that you have the latest audio driver installed for the audio device.
    (5) make sure that you have the latest network driver installed on your device on the network.
    (6) run the game with its smaller settings with the same extras disabled as you can stand it.  Shadows are nice - but will slow down your system.

    And the advice that you said that you do not want to (while remaining general because we do not know the details of your system):

    (1) buy a more grand/more fast video card to replace yours.
    (2) buy more memory system in case you run low during playback.
    (3) replace your processor with the highest that will take care of your particular motherboard.

    And the most extreme:

    (1) buy a system that has a little above the minimum specs for the best interpretation of this game is that you are trying to play.

  • The Pogo game scores

    When you play the Pogo web site, I can't pull up the top of my stats or high scores for the game.  I get a bar message indicating that "Internet Explorer has modified this page to avoid cross-site scripting.  any ideas?

    Under the tab security for IE8 there is a new Section of filter XSS scripts, turn it off and the problem goes away.

  • Add up the scores in the text box with a variable

    Hello

    I create a quiz form that does not use the quiz slides (5,5) standard Adobe Captivate. I get the learner to mark themselves and enter the score into a text entry in a TextAreaWithVariable area. The scores are then displayed on the last page in the corresponding text box TextAreaWithVariable.

    I wish that Captivate to add up the scores on the last page. I've read somewhere that you use Actions in advance, so when the student enters the page it triggers the calculation by using the action of the Expression. The problem is that when you configure the action, it does not recognize the three TextAreaWithVariables on the page. They are all appointed, but the action does not pick up them.

    Could you get it someone please let me know where I am going wrong here.

    Thank you very much

    Nick

    Hi Nick,

    I've been blogging on the use of the text with Variables by Jim box:

    Extended features

    In the article referenced to in this post, you will find explanations in detail the advanced actions that I used.

    But I'm a little afraid that I need additional information:

    • you have a text box, with its variable partner on one page and this variable gets its value (20) by the user
    • How many of these slides you?
    • but then, you talk of multiple partitions that you want to summarize in a total variable to be displayed on another TextArea widget to the last slide.

    How you trigger the advanced actions to calculate the sum? I suggest that use you the action on enter each slide after the first question slide to temporary sum. Try to explain:

    1. Score of the first slide in question entered by the user and stored in the variable v_quest1
    2. Entering the second question slide create this advanced standard action triggered by action on enter on this slide
      • Expression v_sum = v_sum + v_quest1
      • Continue
    3. Entering the third question slide create a similar action with the score stored in v_quest2
      • Expression v_sum = v_sum + v_quest2
      • Continue
    4. When you enter the slide of score you the last of this breakthrough of similar actions to trigger and the final result will be in v_sum

    If you do not need to keep the individual from each question scores, you can even re - use only a single variable v_quest that would be associated with all widgets except on the slide to score and you can reuse the action advanced on each slide without having to edit.

    Lilybiri

  • During the Olympic Games, I put my national flag as a theme of background on my search home page, can't get rid of it

    During the Olympic Games, the option was given to set your national flag as a theme in the background on my homepage to google search. So I have the flag on the top and bottom of my google forward margins. problem is now I don't remember how I installed this and wants to get rid of it. any help would be appreciated, thanks.

    Have you installed a character for the style of the user interface of Firefox or have you set a background for pages in Google?

  • Satellite P100-160, not compatible with the latest games graphics card

    My laptop is the Satellite P100-160, which has a 945GM Express chipset is not able to play the latest games. I understand that the graphic card cannot be replaced. So, which eliminates this option...

    Recently, another solution I've heard of is an external graphics such as the Asus XG station...
    http://www.Trustedreviews.com/graphics/News/2007/01/15/ASUS-makes-first-external-laptop-graphics-card/P1
    either this...
    http://www.coolest-gadgets.com/20070611/MSI-luxium-offers-external-graphics-solution-for-notebooks/

    However these devices large need an express card slot, which I'm not sure that this laptop has even?

    If it's not there ways to add to my laptop? And if not, what other options are available to me that may help my laptop to face the latest games?

    Thank you

    Richard

    Hello

    The Intel graphics card is simply not powerful enough to handle the latest PC games.
    You think so, why all the hardcore gamer don t buy computers laptops, but during the CPU clock and buy new graphics for PC s Office cards?

    The laptop is not comparable with the desktop PC. It's just different technology according to the limitations of hardware upgrade on your laptop, you can spend only the HARD drive and RAM.
    You cannot add also all other ports for laptop. It is not possible :(

  • Lenovo v580 - full screen scale - work is not in the old games

    Intel HD 4000 defining "scale full screen" does not work in the old games.

    http://S22.postimg.org/lg4djhww1/image.PNG

    For example "heroes of might and Magic IV" (maximum resolution of the game is 1024 x 768-... system doesn't add black borders to fit screen - instead of graphics in fullscreen scaling).

    For me, this option only works on the desktop.

    My office is graduated in resolution 1024 x 768 (screen looks wider)- but when I start the game with the same resolution (1024 x 768), the system adds just black horizontal borders... to adapt (1366-1024) = 342 pixels horizontally.

    I'm trying to re - install my graphic drivers (Intel and NVidea), but not luck.

    Currently, my driver is up to date.

    This is my DxDiag report:

    https://drive.Google.com/file/d/0B8PlsvE7ME5NLVVKd0dRaFpVTlk/view?USP=sharing

    I've found the workaround:

    There are several modes of resolution of 1024 x 768 and one of them is what I need.

    So I write my C program to set the correct resolution after the beginning of the game.

    My plan to write the application that wants to hear it to display the windows and so undermined resolution system settings change message (for example 1024 x 768 without scale full screen)-my application will fix it (will change resolution to 1024 x 768 with full screen scale).

  • How to change the background color in the Solitaire game

    I would like to know if there is a way to extend the colors for the SOLITAIRE game? My father detects the colors of the background and maps are too hard and they appear blurry to me and him also. He wondered if we could add more colors in order to get more variety in both the background and maps. Thank you!

    Sandy

    Hello

    You will not be able to add colors for maps or background, but you can change the color of background and maps and also to enlarge the maps.

    a. Click Start, click games.
    b. Open Solitaire.
    c. click on the game and then click change appearance.
    d. Select your favorite background or bridge color.
    e. Select the option "Large print bridge." This will expand the ID card, but not the card. Cards will be the same size, but the name of the map will be bigger.

    Reference:
    http://Windows.Microsoft.com/en-us/Windows7/Solitaire-how-to-play

    Kind regards
    Afzal Taher - Microsoft technical support.
    Visit our
    Microsoft answers Feedback Forum and tell us what you think.

  • Can't win the pocker game!

    Hi, everyone, you may think that it is a ridiculous problem.
    But I do not.

    My question is:
    Are all game sets are supposed to be there at least a way to clean up the game?

    I am very happy game of Poker of Win7 and it's really not easy more.
    I must say it's my favorite game now.
    But I can't win the game this time.

    I think you guys should add only a game in the game code.
    After, to random shuffle, there should be a code that made to challenge the same game.
    In my case, I might post the Web site code, others might enter the code to see the same game and try to solve it.
    I think it would be fun.

    Now, I need some advice to clear the game.
    I wonder how can I upload images to the Web site.
    Y at - it someone could help?
    Or through sort, you can reproduce the same game on my side.

    Hello

    Are you looking for cheaters?

    If so, try http://www.tucows.com/preview/608834

    Good luck $

  • images in the pogo games

    I HAVE WINDOWS VISTA AND ONCE MORE STRUGGLING WITH THE LOADING OF THE IMAGE SET IN THE POGO. I CAN GET TO ROOMS LAODING THEN I GET MESSAGE ERRO THAT SAYS CANNOT LOAD GAME IMAGES. I DID EVERTHING ON HELP OF POGO AND CHECKED EVERTHING. WE ME SAID I THINK HE CAN THERE BE A SETTING SOMEWHERE IN MY COMPUTER, BUT DON'T KNOW WHAT IT COULD BE. I KNOW THAT IT IS FIXABLE IF SHE HAD DONE BEFORE, BUT THE PERSON WHO DID IT WALKED AWAY. I DID THINGS THAT HAVE BEEN MENTIONED HERE AND IT DID NOT WORK. SOMETHING IS NOT LETTING THE IMAGES WORK. I CAN'T GET INTO THE POGO. CLUES. Thank you

    Deanstephe5,
    This problem is apparently related to Java and some security settings.  First of all, make sure that you have the latest version of Java installed.  Then, go to tools > Internet Options > Advanced tab, click on Manage Add-ons search the Java and make sure it is all turned on, and then scroll down further to see if there is an entry named "SSVHelperclass" of Sunmicrosystems, Inc. and Sun Java console, by the Sunmicrosytems.  Allow each of them, and then restart Internet

    The other thing you can do is to add pogo.com to trusted sites in IE, tools, Internet Options Security tab.

    Let us know if this can help, or if you are still having the problem.

    Thank you, Gloria
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to uninstall the EverQuest game on windows xp?

    How to uninstall the EverQuest game on windows xp? all game files there are a lot of hidden files & I can't find any program uninstaller. I do not think that
    I should just delete the files I've met without uninstalling. I need to get rid of all EverQuest files on this computer. the game files were on the computer when I got it & the game takes as much memory. game files are everywhere but they are hidden. can someone help me please?

    Hello

    I suggest for the link and follow the steps in the article:

    How do I add or remove games in Windows XP

    http://support.Microsoft.com/kb/307768#top

     
    I hope this helps. If you have any other queries/issues related to Windows, write us and we will be happy to help you further.
  • I inadvertently deleted the standard games included with Windows (Solitaire...). Can I reinstall somewhere?

    When I perform a cleaning disc, I inadvertently deleted the standard games that come with windows.  How to make a comeback?

    Yes. Use the Add or remove Windows from the control panel components. See:

  • Repeat the same games

    When I play on 'Games' (hearts, Solitare, etc.), the program continues to repeat the same games (I should win all the time, eh?).  How can I reset the program of the games.

    Hello

    The games provided in Windows Vista are not games at several levels.

    However, you can improve your scores by playing the games each time.

    If you are having problems with one of the games, then you can reinstall games using Windows Turn On or Off features.

    a. go to Start and in the search type "or turn off Windows features turn on."

    b. click on 'Windows turn features on or off".

    c. find the games and uncheck the mark before the game that you want to uninstall.

    d. restart the computer.

    e. once the computer is restarted, go to the same location and place a check mark for the game to be installed. Restart the computer once more for the game is installed successfully.

    See: http://windows.microsoft.com/en-us/windows-vista/Learn-about-Windows-games

    Hope this information is useful.

Maybe you are looking for

  • Media Center M7060n PC does not start

    I restarted the pc this AM when it was slow. No change recently, the last was an update of Microsoft a few days ago, but the pc seemed to work OK. All virus day and firewall. PC hangs on the "Windows XP" logo. It will restart in safe mode of Windows

  • Desktop HP ENVY 700: problems with the boot from usb in the bios

    Hi I'm trying to boot from usb on a desktop HP ENVY 700. I don't know the serial number now. I followed the instructions and have produced a bootable USB and I checked this on a work dell computer where there is an option for me to boot from my USB i

  • 15 - af103ax: OPTICAL DRIVE READ WRITE COMPARE TEST: FAILED

    ODD my laptop HP is not able to write disks, the performance of Optical Drive Read compare Test he gave me a "failed" message with ID QBRXWM-7RV87M-XD7WMF-6HLB03 failure.

  • Input data for digital indicator tab does not exist

    Hello I'm trying to define the range of data for the numerical indicators on LabVIEW 10.0.1. For some reason when I go into the properties of my digital indicator, there is no input data tab as explained on the Web site of NOR: http://zone.ni.com/ref

  • Arial Narrow Bold missing XP 2nd edition Internet Explorer 8

    I downloaded the latest Airport Design Editor, claiming Ariel "BOLD" narrow, which is not in XP home edition 2nd. How to please the police if necessary.  Robin