Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Flash game help please

  • 13-05-2005 01:38PM
    #1
    Closed Accounts Posts: 25


    I have a scene in flash that has a movie clip with code attached, but i load the scene on its own its works perfect, but when the game is loaded the scene wont loop, ive tried neraly everything below is the code attached to the movie clip but in the movie clip calles like "gotoAndPlay" dont work,
    please help


    /*onClipEvent (load) {
    // declare and set initial variables
    thrust = 1;
    decay = .97;
    maxSpeed = 30;
    var tune= new String("");
    var l_hit= "";
    var end = false;
    var temp
    }
    onClipEvent (enterFrame) {

    if (_root.roc.hitTest(32,98,true) && l_hit != "drum")
    {
    //gotoAndPlay("Scene 5", 0);
    test1 = new Sound(this);
    tune =tune.concat("d");
    test1.attachSound("drum1");
    test1.start(0,1);
    l_hit= "drum";

    }

    if (_root.roc.hitTest(417,111,true) && l_hit !="flute" )
    {
    test2 = new Sound(this);
    tune = tune.concat( "f");
    test2.attachSound("flute2");
    test2.start(0,1);
    l_hit= "flute";


    }
    if (_root.roc.hitTest(224,28,true) && l_hit !="guitar" )
    {
    test2 = new Sound(this);
    tune = tune.concat( "g");
    test2.attachSound("guitar1");
    test2.start(0,1);
    l_hit= "guitar";


    }


    if (_root.roc.hitTest(213,206,true) && l_hit !="sax" )
    {
    test2 = new Sound(this);
    tune = tune.concat( "s");
    test2.attachSound("sax1");
    test2.start(0,1);
    l_hit= "sax";


    }

    // rotate right or left
    if (Key.isDown(Key.RIGHT)) {
    _rotation += 10; // adjust these for usability test diofferent versions
    }

    if (Key.isDown(Key.LEFT)) {
    _rotation -= 10; // adjust these for usability test diofferent versions
    }
    //
    //
    if (Key.isDown(Key.UP)) {
    // calculate speed and trajectory based on rotation
    xSpeed += thrust*Math.sin(_rotation*(Math.PI/180)); // from tutorial
    ySpeed += thrust*Math.cos(_rotation*(Math.PI/180)); // from tutorial
    //xSpeed +=1;
    //ySpeed +=1;
    flames._visible = 1;
    } else {
    // deccelerate when Up Arrow key is released
    xSpeed *= decay;
    ySpeed *= decay;
    //xSpeed = 0;
    //yspeed = 0;
    flames._visible = 0;
    }
    //
    // maintain speed limit
    speed = Math.sqrt((xSpeed*xSpeed)+(ySpeed*ySpeed));
    if (speed>maxSpeed) {
    xSpeed *= maxSpeed/speed;
    ySpeed *= maxSpeed/speed;
    //xSpeed = maxSpeed/speed;
    //ySpeed = mexspeed/speed;

    }
    //
    // move beetle based on calculations above
    _y -= ySpeed;
    _x += xSpeed;
    //
    // loop to opposite side of the stage when the beetle travels off-screen
    if (_y<0) {
    _y = 232;
    }
    if (_y>232) {
    _y = 0;
    }
    if (_x<0) {
    _x = 465;
    }
    if (_x>465) {
    _x = 0;
    }


    trace(tune);
    if (tune == "df"){
    test3 = new Sound(this);
    test3.attachSound("won");
    test3.start(0,1);
    end = true;
    trace("heeeeeeeeeeeeeeeeeeee");
    //gotoAndPlay("Scene 3", 1);
    }
    //gotoAndPlay("Scene 5", 0);

    if (end==false)
    {
    //gotoAndPlay(0);
    }
    }
    */


Advertisement
Advertisement