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
I have no idea its strange to me.
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…? :-\
the code is inside the mc called level (w/ the blocks)
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…
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.)
ack, me 2 dumb 4 this, lol
thats ok lol
anyone else have a solution?
thanks again
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+:
wow, kirupa stumped??
this IS weird!!
thanks for trying
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.
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
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.
- Have lengthy code to make them all visible again.
- Actually name the instances and have different named instances on each level.
- 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.
thanks!!! yeah, i follow
ur a lifesaver!! :))))))))))
Your welcome.
Might do you an example of using an array if i get some free time in a day or two.
Regards,
Viru.