Results 1 to 4 of 4

Thread: Menu in the game is broken

  1. #1

    Menu in the game is broken

    Hy

    Before my game starts it has introduction.
    When my ship lost energy then is game over.
    In the game over layer is button called menu and it should back player to menu.
    There is a problem.
    I don't know how to do it so it looks good.

    Ships are still moving and the stars also move.
    I want them to stop and dissapear.

    it's urgent!

    Please help!

    thx
    Attached Files Attached Files

  2. #2
    Hey buddy, Just add the following code your game over frame. This should fix your problem.
    Code:
    for(var i in this)
    {
        if(typeof(this[i]) == "movieclip")
        {
            removeMovieClip(this[i])
        }
    }
    Basiclly wots happening is that your attaching movieClips but the attached movieClips always stay the staged untill and unless you remove them using the removeMovieClip() function. So the above code does just tht.
    Ps: This function only removes attached movieClips.

  3. #3
    Thank's

    It work's great

    Could you help me one more time?

    What i need to if i want to see stars behind my spaceship, enemy spaceship.....behind everythink?

    please help - i have time until tommorow morning

    thx

  4. #4
    Quote Originally Posted by zerdec View Post
    Thank's

    It work's great

    Could you help me one more time?

    What i need to if i want to see stars behind my spaceship, enemy spaceship.....behind everythink?

    please help - i have time until tommorow morning

    thx
    Hey for here is a simple solution. I just modified the way u create stars. The Bold part is the code that i have changed. What we do is bascially create a "empty" movieClip And Attach the stars movieclip inside this "empty" movieclip. Then we swapDepths between "hero" and the "empty" movieClip. This way The Hero movieClip gets the highest depth and appears on top of everything. Hope you understand.

    Code:
    function createStars ()
    {
        var sky = _root.createEmptyMovieClip ("star_c", _root.getNextHighestDepth ());
        sky.swapDepths (hero); //Swap depths with the hero movieClip.
        for (var i = 0; i < stars; i++)
        {
            var mc = sky.attachMovie ("star", "star" + i, i);
            //trace (mc);
            mc._x = random (Stage.width);
            mc._y = random (Stage.height);
            mc.speed = random (maxSpeed - minSpeed) + minSpeed;
            var size = random (2) + 0.6 * (random (4));
            mc._width = size;
            mc._height = size;
        }
    }
    createStars ()// initiliaze the function
    
    _root.onEnterFrame = function ()
    {
        for (var j = 0; j < stars; j++)
        {
            var mc = star_c["star" + j];
            if (mc._x > 0)
            {
                mc._x -= mc.speed;
            }
            else
            {
                mc._x = Stage.height;
                mc.speed = random (maxSpeed - minSpeed) + minSpeed;
                mc._x = random (Stage.width);
            }
        }
        if (paused == false)
        {
            _root.pause._visible = false;
            moveHero (8);
        }
        else
        {
            _root.pause._visible = true;
        }
        if (sound_on != true)
        {
            stopAllSounds ();
        }
    };

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012