//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Place a transparent non-0 combo FFC on screen with the script attached. //
//D0: Walkable combo to be used for 1-way platform //
//D1: Solid (Either completely or top-only) combo to be used for 1-way platform //
//Both of these combos should use the same tile, or it will look a bit wierd. //
//D2: Boolean value. If 0, the player can press down to fall through the platforms. If anything else, the player cannot fall through them. //
//The platform combos MUST BE PLACED ON LAYER 0. You can place either the solid or walkable, it will make no difference. //
//This will only function on screens which have the Sideview Gravity screen flag enabled. //
// AUTHOR: Venrob // VERSION: 1.1 (1/10/2018) //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////DEFAULTS:
const int COMBO_DEF = 0; //Default combo to use if no D0 passed. This should be a completely walkable combo.
const int COMBO2_DEF = 0; //Default combo to use if no D1 passed. This should be a combo that is solid on the top, if not completely.
ffc script SideViewPlatform{
void enemyFallFix(int combo1){
for(int i = 1;i<=Screen->NumNPCs();i++){
npc anNPC = Screen->LoadNPC(i);
if(Screen->ComboD[ComboAt(anNPC->X,anNPC->Y+16)]==combo1||Screen->ComboD[ComboAt(anNPC->X+15,anNPC->Y+16)]==combo1){
anNPC->Jump=0;
}
}
for(int i = 1;i<=Screen->NumItems();i++){
item anItem = Screen->LoadItem(i);
if(Screen->ComboD[ComboAt(anItem->X,anItem->Y+16)]==combo1||Screen->ComboD[ComboAt(anItem->X+15,anItem->Y+16)]==combo1){
anItem->Jump=0;
}
}
}
void run(int combo1, int combo2,bool canFall){
if(!IsSideview())Quit();
canFall = !canFall;
if(combo1==0)combo1=COMBO_DEF;//If no combo1 passed, use default.
if(combo2==0)combo2=COMBO2_DEF;//If no combo2 passed, use default.
while(Link->Action != LA_SCROLLING){
int comboRow = Floor((ComboAt(Link->X,Link->Y+15)+1)/16)+1; //A number representing what row of combos is to be solid/walkable
if(canFall&&Link->InputDown){
for(int i = 0;i<=175;i++){
if(Screen->ComboD[i]==combo2)SetLayerComboD(0,i,combo1);//Make all platforms walkable if Link holds down & falling enabled
}
}else{
for(int i = 0;i<=175;i++){
if(Screen->ComboD[i]==combo2&&i/16<=comboRow)SetLayerComboD(0,i,combo1);//Make all solid combos above/next to link walkable
if(Screen->ComboD[i]==combo1&&i/16>comboRow)SetLayerComboD(0,i,combo2); //Make all walkable combos below link solid
}
}
enemyFallFix(combo1);
Waitframe();
}
}
}