This keeps track of how many movieClips _currentframe is 200-300, the first time the code is run it initializes it at zero, each time after that it is reseting it to zero.
for(i=1; i<5; i++){
if(_root["block"+i]._currentframe>=200 && _root["block"+i]._currentframe<=300){
count++;
}
- for(i=1; i<5; i++){
- if(_root["block"+i]._currentframe>=200 && _root["block"+i]._currentframe<=300){
- count++;
- }
This is probably the first thing yor still looking at.
_root["block"+i] is referencing a movieclip in _root, puting the string "block" & the number that
i is at in the loop together making a new string that is seen by Flash as the instanceName of a movieClip, an object or a variable.
you can also use
this["firstPart" + variable] &
_parent["firstPart" + variable] the same way. The only difference between the three is where Flash will start looking for the clip/variable/object.
So if our loop is at 3 then
_root["block"+i]._currentframe is seen as
_root.block3._currentframe by Flash.
count++ is just adding 1 to the number of movieClips that return true to the "if" statement.
This next part would have had me scratching my head awhile ago, it's called a "tertiary" & lostinbeta gives a most exelent explaination
Here (halfway through 6th post)Basically this,
count==4 ? (gotoAndPlay(3), delete count, delete _root.onEnterFrame) : null;
translates to this,
if(count==4){
gotoAndPlay(3);
delete count;
delete _root.onEnterFrame;
}else{
null; // do nothing except start this code all overagain untill count is==4
- if(count==4){
- gotoAndPlay(3);
- delete count;
- delete _root.onEnterFrame;
- }else{
- null; // do nothing except start this code all overagain untill count is==4
As for the movieclips all being the same color once in awhile i'm guessing you have no conditional statement in your randomization function.
Somthing close to this should fix it,
average = (randomValue1 + randomValue2 + randomValue3 + randomValue4) / 4;
if(average==randomValue1 && average==randomValue2 && ..rest of vals){
randomValue1=3;
randomValue3=1;
delete average;
}
- average = (randomValue1 + randomValue2 + randomValue3 + randomValue4) / 4;
- if(average==randomValue1 && average==randomValue2 && ..rest of vals){
- randomValue1=3;
- randomValue3=1;
- delete average;
- }
This finds an average of all values, if the average is equal to every one of them by themself then they are all the same, if they are all the same it rewrites values 1 & 3 to 3 & 1 leaving 2 & 4 as they are ensuring that all of the cubes random values will never be the same.
Your game kinda reminds me of a Rubix Cube

Strong with this one, the sudo is.