Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

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