dcsimg
A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Score sends to new scene

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    11

    Question

    Hey, all.. I'm having a problem (isn't that why most people post here?

    Anyways, I'm trying out my hand at scripting a game through Actionscript. I've got my two levels working independantly, but I can't get it to move from level one to level two! Here's the code:

    if (this.hitTest(_root.ship)) {
    _root.gotoAndStop("gameOver");
    } else if (score>=200) {
    gotoAndPlay ("Scene 2", 1);
    }

    The first part is working, killing the player when hit, but the second part (The else if) doesn't work.

    score is the variable assigned to a dynamic text box.

    Thanks in advanced,
    Kim

  2. #2
    Registered User
    Join Date
    Nov 2000
    Posts
    136
    Before the if statement, do this:
    trace(score);

    Then, inside the else if clause, put this:
    trace("Attempting to go to scene 2.");

    When score reaches 200, the second trace should be executed. If it isn't, the problem is in your if statement. But if the second trace is executed, then the problem is in you gotoAndPlay() action.

    If it's the goto action, you might try putting both of your levels in the same scene. Flash can be a little buggy with scenes.

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    11
    If it's the goto action, you might try putting both of your levels in the same scene. Flash can be a little buggy with scenes.
    Well, The Output window is opening, but nothing is coming through on it, so I'm not sure if it's executing or not.

    AS for it being in the goto action, I had the same problem when I tried it that way. That's why I decided to try it with scenes.

  4. #4
    Registered User
    Join Date
    Nov 2000
    Posts
    136
    Does the "trace(score)" appear in the output window?

  5. #5
    Junior Member
    Join Date
    Apr 2002
    Posts
    11
    ..Actually, nothing appears in the output window. :P

    It extends with the scrollbar, but nothing shows up.. Just empty lines!

  6. #6
    Registered User
    Join Date
    Nov 2000
    Posts
    136
    Ah. That's because you have the output window turned off. Right-click on it and change the debug level to "Errors".

  7. #7
    Junior Member
    Join Date
    Apr 2002
    Posts
    11
    I'm not given the option to set any levels. :P All I've go the choice of is to 'copy' 'clear' 'save to file' or 'print'


  8. #8
    Registered User
    Join Date
    Nov 2000
    Posts
    136
    That's, uh, odd. Is there an "Options" menu in the upper-right corner of the output window?

  9. #9
    Junior Member
    Join Date
    Apr 2002
    Posts
    11
    There is, but it only gives the same options.

    This program isn't making it easy for me to learn it!

  10. #10
    Registered User
    Join Date
    Nov 2000
    Posts
    136
    OK, try this: Go to the File menu, and pick "Publish Settings". Go to the "Flash" tab (if it's not there, check the "Flash" box on the left). Make sure "Omit Trace" isn't checked.

  11. #11
    Junior Member
    Join Date
    Apr 2002
    Posts
    11
    Checked.. It isn't checked. Nothing is, in fact. Is there maybe another way that I can get it to move to the second scene?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center