CODE
//The Red/Blue block system, much like in the Oracles games
const int CMB_OFFORB = 19072; //Orb to switch blocks
const int CMB_BLUEBLOCK = 19076; //Blue block
const int CMB_REDBLOCK = 19080; //Red block
bool BlockState;
ffc script RedBlueBlock{
void run(int blueoff, int redoff, int offorb){
int orb[5]; //Arbitrary value of max orbs per screen
int orbcount;
bool switched;
if(offorb==0) offorb = CMB_OFFORB;
if(blueoff==0) blueoff = CMB_BLUEBLOCK;
if(redoff==0) redoff = CMB_REDBLOCK;
for(int i=0;i<176;i++){
if((Screen->ComboD[i] == blueoff && BlockState) || (Screen->ComboD[i] == redoff && !BlockState)) Screen->ComboD[i] += 2;
if(Screen->ComboD[i] != offorb || orbcount == 5) continue;
orb[orbcount] = i;
orbcount++;
}
while(true){
switched = false;
while(!switched){
Waitframe();
for(int i=0;i<orbcount;i++){
for(int j=1;j<=Screen->NumLWeapons();j++){
lweapon check = Screen->LoadLWeapon(j);
if(check->ID == LW_BOMB || Abs(check->X-ComboX(orb[i])) >= 8 || Abs(check->Y-ComboY(orb[i])) >= 8) continue;
if(check->ID == LW_BRANG) check->DeadState = WDS_BOUNCE;
if(check->ID == LW_ARROW) check->DeadState = WDS_ARROW;
if(check->ID == LW_MAGIC) check->DeadState = WDS_DEAD;
switched = true;
Screen->ComboD[orb[i]]++;
}
}
}
BlockState = !BlockState;
Game->PlaySound(SFX_SECRET);
for(int i=0;i<176;i++){
if(Screen->ComboD[i] == blueoff || Screen->ComboD[i] == redoff+2
|| Screen->ComboD[i] == blueoff+2 || Screen->ComboD[i] == redoff) Screen->ComboD[i]++;
}
Waitframes(60);
}
}
}
Something like that.
I can't remember how you have to set it up exactly, I'll have a look in a bit.
EDIT:
Ok yeah, blocks are set up like this:
CODE
A|B|C|D
in the combopage, where A is the blue block while it's down. B is an animation of that block moving up, which then cycles to C. C is the blue block while it's up, and D is an animation of the blue block moving down, which cycles back to A.
CMB_BLUEBLOCK should have the value A's combo ID number.
The red blocks should be set up in the same way.
With the crystal, you have two combos. The first is the crystal while it's 'deactivated', then the second one is an animation of it 'activating', which then cycles back to the first combo when the animation finishes. CMB_OFFORB is the combo ID of the first of those two combos. They have to be consecutive otherwise the script won't work.
Other than that you pretty much just bung the script on the screen and go. Only ever place down the 'A' combo for each block, don't ever place any of the other ones in the sequence. The script will make the blocks rise when you enter the screen (make sure it has 'Run scripts at screen init' checked otherwise there won't be up as soon as you enter which looks bad).
D0 D1 and D2 are for different values of the three constants, so if you want different graphics for blocks on certain screens you can edit those, but if you leave them at 0 the constant values are used.