A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: scoredetection in a game..(script)

  1. #1

    Smile

    ive made a rtype style game with 2 scenes
    "level1" and "level2"
    1 spaceship..1 duplicated enemy...1 pikupitem..laser and a variable score in a dynamic text field
    my problem is that i want the movie to go to scene2 when a specific score is hit here is the script for the laser cause thst is where the score is worked out any help would be muuch appreciated onClipEvent (load) {
    score=0;
    laserMoveSpeed = 75;
    this._y = _root.spaceship._y;
    this._x = _root.spaceship._x+50;
    }
    onClipEvent (enterFrame) {
    this._x += laserMoveSpeed;
    if (this._x>=700) {
    _root.spaceship.lasercounter--;
    this.removeMovieClip();
    }
    for (i=1; i<=_root.numEnemy; i++) {
    if (this.hittest(_root["enemy1"+i])) {
    _root["enemy1"+i].gotoAndPlay(2);
    _root.score+=200;
    this.removeMovieClip();
    } else {
    if (_root.score>=500) {
    _root.gotoAndPlay("level2");
    }
    }
    }
    if (this.hittest(_root.enemy)) {
    _root.enemy.gotoAndPlay(2);
    _root.score+=200;
    this.removeMovieClip();
    } else {
    if (_root.score>=500) {
    _root.gotoAndStop("level2",1);
    }
    }
    }


  2. #2
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    hehe - cool name... luckily my nick wasn't reserved when i registered

    i think you should remove the else statements from your code. i can't figure out why "else" is useful here, if it is tell me why so that i can review the code with your ideas in mind.

    Yours
    HTD

  3. #3
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    I've made almost the same thing and i resolved my problem with a tellTarget like :
    tellTarget ("_level0") {
    gotoAndStop ("level2", 1);
    }

    I hope this will help you.

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