User Tag List

Results 1 to 2 of 2

Thread: Big Pushblocks?

  1. #1
    Lynel Majora's Avatar
    Join Date
    Mar 2006
    Age
    32
    Posts
    1,197
    Mentioned
    24 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    4,388
    Level
    20
    vBActivity - Bars
    Lv. Percent
    93.92%

    Big Pushblocks?

    Has anyone written a script for these? Blocks that can be any size from 2x1 to 4x4 and everything in between, with flags to simulate heavyness and how many times they can be pushed and in what directions (unless a large FFC can respond to a single push/direction flag on it consistently)

  2. #2
    Empty and become Moosh Moosh's Avatar
    Join Date
    Oct 2012
    Posts
    57
    Mentioned
    13 Post(s)
    Tagged
    4 Thread(s)
    vBActivity - Stats
    Points
    625
    Level
    8
    vBActivity - Bars
    Lv. Percent
    88.72%
    I was very very bored so I shat out that script you needed. Hope it helps.
    Code:
    //Moosh's Large Push Block Script V1.0
    //D0: Set this to 1 if you want the block to only be pushable once
    //D1: Push directions:
    //	0=Up
    //	1=Down
    //	2=Left
    //	3=Right
    //	4=Vertical
    //	5=Horizontal
    //	6=4-Way
    //D2: Set this to 1 if you want the block to trigger a temporary secret
    //	Set this to 2 if you want the block to trigger a permanent secret
    //D3: If you want the push block to require an item to use, set this to the ID # of the item
    //Set the screen's under combo for the under combo the block uses
    //Be sure to check the quest rule that makes FFCs visible while the screen is scrolling
    ffc script BigPush{
    	bool CanWalkFlag(int flag, int x, int y, int dir, int step, bool full_tile) {
    		int c=8;
    		int xx = x+15;
    		int yy = y+15;
    		if(full_tile) c=0;
    		if(dir==0) return !(Screen->ComboF[ComboAt(x,y+c-step)]==flag||Screen->ComboF[ComboAt(x+8,y+c-step)]==flag||Screen->ComboF[ComboAt(xx,y+c-step)]==flag);
    		else if(dir==1) return !(Screen->ComboF[ComboAt(x,yy+step)]==flag||Screen->ComboF[ComboAt(x+8,yy+step)]==flag||Screen->ComboF[ComboAt(xx,yy+step)]==flag);
    		else if(dir==2) return !(Screen->ComboF[ComboAt(x-step,y+c)]==flag||Screen->ComboF[ComboAt(x-step,y+c+7)]==flag||Screen->ComboF[ComboAt(x-step,yy)]==flag);
    		else if(dir==3) return !(Screen->ComboF[ComboAt(xx+step,y+c)]==flag||Screen->ComboF[ComboAt(xx+step,y+c+7)]==flag||Screen->ComboF[ComboAt(xx+step,yy)]==flag);
    		return false;
    	}
    	bool CanWalkBig(ffc f, int x, int y, int dir, int step){
    		if(dir==DIR_UP||dir==DIR_DOWN){
    			if(dir==DIR_DOWN)y+=16*(f->TileHeight-1);
    			for(int i=0; i<=f->TileWidth-1; i++){
    				if(!CanWalk(x+i*16, y, dir, step, true))return false;
    			}
    			return true;
    		}
    		else if(dir==DIR_RIGHT||dir==DIR_LEFT){
    			if(dir==DIR_RIGHT)x+=16*(f->TileWidth-1);
    			for(int i=0; i<=f->TileHeight-1; i++){
    				if(!CanWalk(x, y+i*16, dir, step, true))return false;
    			}
    			return true;
    		}
    	}
    	bool CanWalkFlagBig(int flag, ffc f, int x, int y, int dir, int step){
    		if(dir==DIR_UP||dir==DIR_DOWN){
    			if(dir==DIR_DOWN)y+=16*(f->TileHeight-1);
    			for(int i=0; i<=f->TileWidth-1; i++){
    				if(!CanWalkFlag(flag, x+i*16, y, dir, step, true))return false;
    			}
    			return true;
    		}
    		else if(dir==DIR_RIGHT||dir==DIR_LEFT){
    			if(dir==DIR_RIGHT)x+=16*(f->TileWidth-1);
    			for(int i=0; i<=f->TileHeight-1; i++){
    				if(!CanWalkFlag(flag, x, y+i*16, dir, step, true))return false;
    			}
    			return true;
    		}
    	}
    	void MoveBlock(ffc f, int dir){
    		Game->PlaySound(SFX_PUSHBLOCK);
    		for(int x=0; x<=f->TileWidth-1; x++){
    			for(int y=0; y<=f->TileHeight-1; y++){
    				Screen->ComboD[ComboAt(f->X+8+x*16, f->Y+8+y*16)]=Screen->UnderCombo;
    				Screen->ComboC[ComboAt(f->X+8+x*16, f->Y+8+y*16)]=Screen->UnderCSet;
    			}
    		}
    		for(int i=0; i<=15; i++){
    			if(dir==DIR_DOWN)f->Y++;
    			else if(dir==DIR_UP)f->Y--;
    			else if(dir==DIR_RIGHT)f->X++;
    			else if(dir==DIR_LEFT)f->X--;
    			WaitNoAction();
    		}
    		for(int x=0; x<=f->TileWidth-1; x++){
    			for(int y=0; y<=f->TileHeight-1; y++){
    				Screen->ComboD[ComboAt(f->X+8+x*16, f->Y+8+y*16)]=f->Data+x+4*y;
    				Screen->ComboC[ComboAt(f->X+8+x*16, f->Y+8+y*16)]=f->CSet;
    			}
    		}
    	}
    	void run(int temp, int dir, int trigger, int itemreq){
    		int tics=0;
    		bool pushable=true;
    		this->X=GridX(this->X+8);
    		this->Y=GridY(this->Y+8);
    		for(int x=0; x<=this->TileWidth-1; x++){
    			for(int y=0; y<=this->TileHeight-1; y++){
    				Screen->ComboD[ComboAt(this->X+8+x*16, this->Y+8+y*16)]=this->Data+x+4*y;
    				Screen->ComboC[ComboAt(this->X+8+x*16, this->Y+8+y*16)]=this->CSet;
    			}
    		}
    		while(true){
    			if(itemreq==0||Link->Item[itemreq]){
    				if(dir!=2&&dir!=3&&dir!=5&&Link->X>=this->X-8&&Link->X<=this->X+8+(this->TileWidth-1)*16&&this->Y>0&&this->Y<160-(this->TileHeight-1)*16){
    					if(dir!=0&&pushable&&CanWalkBig(this, this->X, this->Y, DIR_DOWN, 16)&&CanWalkFlagBig(67, this, this->X, this->Y, DIR_DOWN, 16)&&Link->Y==this->Y-16&&Link->Dir==DIR_DOWN&&Link->InputDown){
    						tics++;
    						if(tics==5){
    							MoveBlock(this, DIR_DOWN);
    							if(temp>0)pushable=false;
    							if(trigger>0){
    								Game->PlaySound(SFX_SECRET);
    								Screen->TriggerSecrets();
    								if(trigger>1)Screen->State[ST_SECRET]=true;
    							}
    						}
    					}
    					else if(dir!=1&&pushable&&CanWalkBig(this, this->X, this->Y, DIR_UP, 16)&&CanWalkFlagBig(67, this, this->X, this->Y, DIR_UP, 16)&&Link->Y==this->Y+8+(this->TileHeight-1)*16&&Link->Dir==DIR_UP&&Link->InputUp){
    						tics++;
    						if(tics==5){
    							MoveBlock(this, DIR_UP);
    							if(temp==1)pushable=false;
    							if(trigger>0){
    								Game->PlaySound(SFX_SECRET);
    								Screen->TriggerSecrets();
    								if(trigger>1)Screen->State[ST_SECRET]=true;
    							}
    						}
    					}
    					else if(tics!=0)tics=0;
    				}
    				else if(dir!=0&&dir!=1&&dir!=4&&Link->Y>=this->Y-8&&Link->Y<=this->Y+(this->TileHeight-1)*16&&this->X>0&&this->X<240-(this->TileWidth-1)*16){
    					if(dir!=2&&pushable&&CanWalkBig(this, this->X, this->Y, DIR_RIGHT, 16)&&CanWalkFlagBig(67, this, this->X, this->Y, DIR_RIGHT, 16)&&Link->X==this->X-16&&Link->Dir==DIR_RIGHT&&Link->InputRight){
    						tics++;
    						if(tics==5){
    							MoveBlock(this, DIR_RIGHT);
    							if(temp==1)pushable=false;
    							if(trigger>0){
    								Game->PlaySound(SFX_SECRET);
    								Screen->TriggerSecrets();
    								if(trigger>1)Screen->State[ST_SECRET]=true;
    							}
    						}
    					}
    					else if(dir!=3&&pushable&&CanWalkBig(this, this->X, this->Y, DIR_LEFT, 16)&&CanWalkFlagBig(67, this, this->X, this->Y, DIR_LEFT, 16)&&Link->X==this->X+16+(this->TileWidth-1)*16&&Link->Dir==DIR_LEFT&&Link->InputLeft){
    						tics++;
    						if(tics==5){
    							MoveBlock(this, DIR_LEFT);
    							if(temp==1)pushable=false;
    							if(trigger>0){
    								Game->PlaySound(SFX_SECRET);
    								Screen->TriggerSecrets();
    								if(trigger>1)Screen->State[ST_SECRET]=true;
    							}
    						}
    					}
    					else if(tics!=0)tics=0;
    				}
    			}
    			Waitframe();
    		}
    	}
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social