User Tag List

Results 1 to 9 of 9

Thread: Screen Scrolling. (or more like proof of usability with Z1 engine)

  1. #1
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,827
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,978
    Level
    33
    vBActivity - Bars
    Lv. Percent
    28.3%

    Screen Scrolling. (or more like proof of usability with Z1 engine)

    ..To an extent anyway.

    Video - http://www.youtube.com/watch?v=hL7BBtLcVFY

    If you're too lazy to read the youtube caption:
    It's something I threw together based on a fun little zc game I made that is yet to be released.

    Basically the Idea behind this is that if you keep the "screens" no bigger than about 512 x 352 (combined size of 4 normal sized ZC screens) then you could use the built in enemies and other useful stuff without having to re-script everything from the ground up. Obviously LTTP styled dungeons come to mind here.


    Things that need to be added:
    *Enemy solidity checking.
    *Algorithm for sorting and using flags.

    Things I've half-assed:
    *Link solidity checking
    *Scrolling when you get to the edge of the screen


    Code:
    int  DATA[704];
    int  CSET[704];
    int  SOLID[704];//should probably use this too
    int CX[704];
    int CY[704];
    int Varea = 144;
    int lx; int ly;//Link
    
    void initArena(int screen)
    {//I'd keep this function at global scope
    	int i=1; int j;
    	for(j=0;j<704;j++){
    		CX[j]=(j<<4)%512;
    		CY[j]=(j>>5)<<4;
    	} i=1;
    	for(j=0;j<352;j++){
    		DATA[j] = Game->GetComboData( Game->GetCurMap(), screen+((j>>4)%2), j%(16*i) );
    		CSET[j] = Game->GetComboCSet( Game->GetCurMap(), screen+((j>>4)%2), j%(16*i) );
    		if(j%32==0&&j>0)i++;
    	} i=1;
    	for(j=352;j<704;j++){
    		DATA[j] = Game->GetComboData( Game->GetCurMap(), screen+16+((j>>4)%2), j%(16*i) );
    		CSET[j] = Game->GetComboCSet( Game->GetCurMap(), screen+16+((j>>4)%2), j%(16*i) );
    		if(j%32==0&&j>352)i++;
    	}
    }
    
    bool move[4];int increment = 17;
    global script scroll{
    	void run(){
    		int i; int j; int k; int l;int x; int y;int dx;int dy;
    		
    		initArena(increment);
    		lx = 240;
    		ly = 160;
    
    		while(true){
    
    			Waitframe();
    			
    			for(i=0;i<4;i++)move[i]=true;
    			for(i=0;i<704;i++)
    				if(Abs(CX[i]-lx) < Varea)
    					if(Abs(CY[i]-ly) < Varea)
    					{ //first we draw it
    						//Screen->DrawCombo(1, Link->X + (CX[i]-lx), Link->Y + (CY[i]-ly), 
    							//DATA[i], 1, 1, CSET[i], 1, 0, 0, 0, 0, 0, false, 128);
    //
    //updated to use FastCombo. -Gleeok
                                            Screen->FastCombo( 1, Link->X + (CX[i]-lx), Link->Y + (CY[i]-ly), DATA[i], CSET[i], 128 );
    					//next we check for a collision 
    						if(DATA[i]>3){
    							dx = Abs(lx-CX[i]);dy = Abs(ly-CY[i]);
    							if(dx<17&&dy<17){
    								if(CX[i]==lx+16&&dy<16)move[3]=false;
    								if(CX[i]==lx-16&&dy<16)move[2]=false;
    								if(CY[i]==ly+16&&dx<16)move[1]=false;
    								if(CY[i]==ly-16&&dx<16)move[0]=false;
    							}
    						}
    					}
    			Wok();//don't run! not supported by the script :P
    			Stay();//gooood boy. woof! =)
    		}
    	}
    	void Wok()
    	{
    		if(Link->InputUp){Link->Dir=0;if(move[0])if(ly>0)Move(0,-1);}
    		else if(Link->InputDown){Link->Dir=1;if(move[1])if(ly<384)Move(0,1);}
    		if(Link->InputLeft){Link->Dir=2;if(move[2])if(lx>0)Move(-1,0);}
    		else if(Link->InputRight){Link->Dir=3;if(move[3])if(lx<512)Move(1,0);}
    		if(Link->InputStart){ increment++;initArena(increment); }
    		Link->InputStart=false;
    
    		if(!move[0])Link->InputUp=false;
    		if(!move[1])Link->InputDown=false;
    		if(!move[2])Link->InputLeft=false;
    		if(!move[3])Link->InputRight=false;
    		Link->X=120;Link->Y=80;
    	}
    	void Move(int x, int y)
    	{//we have to update our screen objects
    		int n = Screen->NumLWeapons();
    		lweapon lw;
    		eweapon ew;
    		npc enemy;
    		int e_num = Screen->NumNPCs();
    		int p =Screen->NumItems();
    
    		for(int i=n;i>0;i--){
    			lw = Screen->LoadLWeapon(i);
    			lw->X -= x;
    			lw->Y -= y;
    		}
    		n = Screen->NumEWeapons();
    		for(int i=n;i>0;i--){
    			ew = Screen->LoadEWeapon(i);
    			ew->X -= x;
    			ew->Y -= y;
    		}
    		item a;
    		for(int i=p;i>0;i--){
    			a = Screen->LoadItem(i);
    			a->X -= x;
    			a->Y -= y;
    		}
    		for(int i = e_num; i>0; i--){
    			enemy = Screen->LoadNPC(i);
    			enemy->X -= x;
    			enemy->Y -= y;
    		}
    		lx += x;
    		ly += y;
    	}
    	void Stay()
    	{
    		int e_num = Screen->NumNPCs();npc enemy;
    		for(int i = e_num; i>0; i--){
    			enemy = Screen->LoadNPC(i);
    			if(enemy->X<-80)enemy->X=-80;
    			if(enemy->X>320)enemy->X=320;
    			if(enemy->Y<-80)enemy->Y=-80;
    			if(enemy->Y>240)enemy->Y=240;
    		}
    	}
    }
    Disclaimer: This script is provided as is yada yada, I have no plans to finish it blah-dee-blah, I'll answer any questions you have durp-de-dee, Have fun!
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  2. #2
    Octorok
    Join Date
    Jan 2008
    Age
    32
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    958
    Level
    10
    vBActivity - Bars
    Lv. Percent
    73.27%

    Re: Screen Scrolling. (or more like proof of usability with Z1 engine)

    Whoa thanks for releasing it. :)

    Do you have the test quest showed in the youtube video?

  3. #3
    Octorok
    Join Date
    Jan 2008
    Age
    32
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    958
    Level
    10
    vBActivity - Bars
    Lv. Percent
    73.27%

    Re: Screen Scrolling. (or more like proof of usability with Z1 engine)

    Sorry for double posting, but the script doesn't seems to work for me...

  4. #4
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,827
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,978
    Level
    33
    vBActivity - Bars
    Lv. Percent
    28.3%

    Re: Screen Scrolling. (or more like proof of usability with Z1 engine)

    Sorry for the late reply. I don't have my computer with me for another coouple of weeks and thus cannot upload the test quest for you. But it only took me about five minutes to put that screen together anyways, so open up Ex 1st quest and I'll walk you through the process...Got it loaded up yet? ..I'll wait.


    ...

    OK, on screen 77 black out every combo on screen with blank combos...walkable ones at that. Now see this:
    Code:
    initArena(increment);
    increment is a rather dumb name for this variable, you might want to use "current_virtual_screen" as it's name instead.

    Notice that it's set to 17. That's screen 11 on the map. So goto that screen and delete it. And do the same to screens 12, 21, and 22. Those four screens are now going to be one single "arena" screen, so go ahead and draw here what will be actually appearing on the screen. Solid combos will work fine. (for Link anyways)

    Now add some enemies to this screen.


    ...Ah ah aaaah! You went back to screen 77 for the enemies right? Gotcha.

    Alright now enable cheats and try it out. And after you test it out try holding the start button. :) Just for fun, hold it untill the game crashes, because it will!

    Hope that helps. Cheers!
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  5. #5
    Octorok Hot Water Music's Avatar
    Join Date
    Dec 2002
    Age
    34
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,415
    Level
    12
    vBActivity - Bars
    Lv. Percent
    75.35%
    I'm getting an error on line 49.

  6. #6
    Octorok Christian's Avatar
    Join Date
    Dec 2008
    Age
    35
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    758
    Level
    9
    vBActivity - Bars
    Lv. Percent
    67.62%
    Ok. Can you tell us what does it say?

  7. #7
    Octorok Hot Water Music's Avatar
    Join Date
    Dec 2002
    Age
    34
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,415
    Level
    12
    vBActivity - Bars
    Lv. Percent
    75.35%
    Woops I mean line 48.

    Here's a screenshot of the error
    http://img20.imageshack.us/img20/5508/errorha.png

  8. #8
    Octorok Christian's Avatar
    Join Date
    Dec 2008
    Age
    35
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    758
    Level
    9
    vBActivity - Bars
    Lv. Percent
    67.62%
    Replace line 48 with this:

    Code:
    Screen->DrawCombo(1, Link->X + (CX[i]-lx), Link->Y + (CY[i]-ly), 
    							DATA[i], 1, 1, CSET[i],-1, -1, 0, 0, 0, 0, 0, false, 128);

  9. #9
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,827
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,978
    Level
    33
    vBActivity - Bars
    Lv. Percent
    28.3%
    Even better would be to replace it with this:
    Code:
    Screen->FastCombo( 1, Link->X + (CX[i]-lx), Link->Y + (CY[i]-ly), DATA[i], CSET[i], 128 );
    Since scripts like this are pretty much the whole reason I added those. ..Actually I just edited the script to use FastCombo.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

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