User Tag List

Results 1 to 6 of 6

Thread: One-way Block script

  1. #1
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.92%

    One-way Block script

    The FFC script for a one-way block seems really simple, so I gave it a whirl. Problem is, the compiler doesn't like the Link->DownPressed() function, or it's relatives. Tells me there is no such function. According to Jman's ZScript documentation, there is... am I missing something in the syntax?

    Code:
    
    // =====================================
    // No_South: While on the tile that this
    // FFC occupies, Link will not be able to
    // move south.
    // =====================================
    
    
    ffc script no_south {
    
    	void run(){
    
    		if ((Link->X >= this->X - 8) && (Link->X <= this->X +8) &&
    		(Link->Y >= this->Y - 8) && (Link->Y <= this->Y +8) &&
    		(Link->UpPressed() == true) ){
    
    			Link->Y = Link->Y + 4;
    		}
    	
    	} // end of void run
    } // end of ffc script
    
    
    
    // =====================================
    // No_North: While on the tile that this
    // FFC occupies, Link will not be able to
    // move North.
    // =====================================
    
    
    ffc script no_north {
    
    	void run(){
    
    		if ((Link->X >= this->X - 8) && (Link->X <= this->X +8) &&
    		(Link->Y >= this->Y - 8) && (Link->Y <= this->Y +8) &&
    		(Link->DownPressed() == true) ){
    
    			Link->Y = Link->Y - 4;
    		}
    	
    	} // end of void run
    } // end of ffc script
    
    
    // =====================================
    // No_East: While on the tile that this
    // FFC occupies, Link will not be able to
    // move East.
    // =====================================
    
    
    ffc script no_east {
    
    	void run(){
    
    		if ((Link->X >= this->X - 8) && (Link->X <= this->X +8) &&
    		(Link->Y >= this->Y - 8) && (Link->Y <= this->Y +8) &&
    		(Link->RightPressed() == true) ){
    
    			Link->X = Link->X - 4;
    		}
    	
    	} // end of void run
    } // end of ffc script
    
    
    // =====================================
    // No_West: While on the tile that this
    // FFC occupies, Link will not be able to
    // move East.
    // =====================================
    
    
    ffc script no_west {
    
    	void run(){
    
    		if ((Link->X >= this->X - 8) && (Link->X <= this->X +8) &&
    		(Link->Y >= this->Y - 8) && (Link->Y <= this->Y +8) &&
    		(Link->LeftPressed() == true) ){
    
    			Link->X = Link->X + 4;
    		}
    	
    	} // end of void run
    } // end of ffc script
    EDIT: I suppose I could just have one function that gets passed an argument from the FFC to tell it which directions are blocked instead. I'd still have the same problem.

    NOTE: If people are making 2-D games, some script like this will help you make platforms, as in Mario 2, that you can jump up through but not fall down through.

  2. #2
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.08%

    Re: One-way Block script

    Quote Originally Posted by C-Dawg
    Problem is, the compiler doesn't like the Link->DownPressed() function, or it's relatives. Tells me there is no such function. According to Jman's ZScript documentation, there is...
    That documentation's out of date. It's no longer a function called DownPressed(), but a bool called InputDown.

  3. #3
    Administrator DarkDragon's Avatar
    Join Date
    Oct 2001
    Posts
    6,228
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    11,028
    Level
    31
    vBActivity - Bars
    Lv. Percent
    8.52%

    Re: One-way Block script

    See for instance http://www.armageddongames.net/showthread.php?t=93851, stickied at the top of this forum

  4. #4
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.92%

    Re: One-way Block script

    Ah, well, there we go. Thanks.

  5. #5
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.92%

    Re: One-way Block script

    What the... now, when I code:

    if (Link->InputDown == true)

    or

    if (Link->InputDown == 1)

    I get an "error: cannot cast bool to float" error message.

  6. #6
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.08%

    Re: One-way Block script

    I believe the == operator is currently only defined for numbers. Just use if(Link->InputDown) instead.

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