# Same code, works once not again! FRUSTRATING! plz help :)

**URL:** <https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839>\
**Category:** Uncategorized\
**Created:** [July 27, 2003, 4:14am UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839 "2003-07-27T04:14:32Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yeldarb](https://avatars.discourse-cdn.com/v4/letter/y/51bf81/32.png) [@Yeldarb](https://forum.kirupa.com/u/Yeldarb)\
**Post date:** [July 27, 2003, 4:14am UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/1 "2003-07-27T04:14:32Z")

</div>

ok, i am making a clone of breakout, (pong type game…). i want it so that when all of the blocks get hit, it goes to the next level. i have the code working on the first to levels, so you get to the third level. but the EXACT same code used on the first two levels won’t work on the third!! I’ve been staring at it for an hour now, and it makes no sense, the fla is attached, someone please help 🙂  
thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 4:26am UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/2 "2003-07-27T04:26:17Z")

</div>

I have no idea its strange to me.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 5:20am UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/3 "2003-07-27T05:20:23Z")

</div>

Is the next level a new swf or something? how come i can’t see it?! And i can’t find the code which makes it go to the next level…? :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 5:21am UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/4 "2003-07-27T05:21:34Z")

</div>

the code is inside the mc called level (w/ the blocks)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 11:18am UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/5 "2003-07-27T11:18:06Z")

</div>

I changed the 3rd frame of the actions from your levels and figured this. Don’t you have to change the numbers of the blocks since there are more now? I did that and it moved to “Not bad for a white boy” though i’m asian and al…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 12:10pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/6 "2003-07-27T12:10:36Z")

</div>

lol  
change the numbers?  
u mean the number that you let “numleft” to?  
that wouldn’t make much of a difference, because it was set to less blocks, so that would mean that the game should go to the next level faster. it’s not a true count of the blocks, it’s just a variable that you set at the beginning of each level, and each time a block is hit, it is set to decrease that variable by one. (that code is set inside the blocks.)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 1:47pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/7 "2003-07-27T13:47:16Z")

</div>

ack, me 2 dumb 4 this, lol

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 2:55pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/8 "2003-07-27T14:55:53Z")

</div>

thats ok lol  
anyone else have a solution?  
thanks again 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 3:56pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/9 "2003-07-27T15:56:50Z")

</div>

I’m stumped. I tried changing this.nextFrame to gotoAndPlay(4), and that still caused a problem. I think the animation is actually going to the next frame, but the blocks aren’t being redrawn. I placed a trace(“3”), trace(“4”), etc. in the code for switching levels, and I was output a 4 and 5 - telling me that the levels actually did change.

Beyond that, I am not sure why it isn’t working 👽

Cheers!  
Kirupa :A+:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 4:10pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/10 "2003-07-27T16:10:03Z")

</div>

wow, kirupa stumped??  
this IS weird!!  
thanks for trying 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 6:53pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/11 "2003-07-27T18:53:59Z")

</div>

I cant find where the code is to make the blocks disappear when they are hit by the ball.

And I cant find the code that will decrease wth ‘numleft’ variable.

Where are they?

EDIT:: Sorry i found it.  
Regards,  
Viru.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 7:08pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/12 "2003-07-27T19:08:57Z")

</div>

it’s in the blocks, double click on them in the level mc  
hope you find something 🙂

EDIT: nvm, i see that u found it 🙂 lol

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 9:43pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/13 "2003-07-27T21:43:05Z")

</div>

In your levels mc i added a layer, named it text. I put a a textbox saying the level number in the corresponding frame. If you play your game you’ll notice that your code works.

But

The problem is that not all the blocks show when you move on a level. This is because you make them invisible so that they dont show, but you dont make them visible again. You solve this in one of three ways.

1. Have lengthy code to make them all visible again.
2. Actually name the instances and have different named instances on each level.
3. Create an array of blocks. With and array you can use a loop to make them visible when the next level is reached.

Do you follow that? And does that answer your first original question?

Regards,  
Viru.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 9:55pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/14 "2003-07-27T21:55:26Z")

</div>

thanks!!! yeah, i follow 🙂  
ur a lifesaver!! :))))))))))

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 9:58pm UTC](https://forum.kirupa.com/t/same-code-works-once-not-again-frustrating-plz-help/26839/15 "2003-07-27T21:58:05Z")

</div>

Your welcome.

Might do you an example of using an array if i get some free time in a day or two.

Regards,  
Viru.
