User Tag List

Page 7 of 7 FirstFirst ... 5 6 7
Results 61 to 62 of 62

Thread: Sidescroll Ladder Script

  1. #61
    Octorok Christian's Avatar
    Join Date
    Dec 2008
    Age
    34
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    739
    Level
    9
    vBActivity - Bars
    Lv. Percent
    56.28%
    You'd do it this way:

    Code:
    global script Slot_2{
       void run(){
           while(true){
          //call the ladder function
             ladder(98);
              Waitframe();
            }
         }
     }
    global variablies and constants goes on top of the global script file, each variable ending in a semi-colon.

    you can also change the variable 98 to any other flag number of your choice. you can only use flags 98 - 102 for now though.

  2. #62
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,141
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.37%

    Re: Sidescroll Ladder Script

    Doing the work for you:
    Code:
    import "std.zh"
    
    //global variables go here
    bool has_hover = false;
    bool on_ladder = false;
    
    global script onstart {
      void run() {
       
        //one time things go here
       
        while(true) {
         
          //function calls go here
          ladder(98);
         
          Waitframe();
        }
      }
     
      //functions go here
      //Courtesy of Saffith/beefster09
      bool isSolid(int x, int y) {
       
        if(x<0 || x>255 || y<0 || y>175) return false;
        int mask=1111b;
         
        if(x % 16 < 8)
          mask &= 0011b;
        else
          mask &= 1100b;
       
        if(y % 16 < 8)
          mask &= 0101b;
        else
          mask &= 1010b;
       
        int ret = Screen->ComboS[ComboAt(x, y)] & mask;
        return (ret!=0);
     
      }
     
      void ladder(int f) {
        int lc;
       
        lc = ComboAt(Link->X+8, Link->Y+15); //for speed
       
        if(Screen->ComboF[lc] == f || Screen->ComboI[lc] == f) {
          if(!on_ladder) {
            on_ladder = true;
            has_hover = Link->Item[I_HOVERBOOTS];
            Link->Item[I_HOVERBOOTS] = false;
          }
          Link->Jump = 0;
          Link->Z = 0;
          Link->Dir = DIR_UP;
         
          if(Link->InputDown) {
            Link->InputDown = false;
            Link->Action = LA_WALKING;
            if(!isSolid(Link->X, Link->Y + 16)) Link->Y += 1;
          }
          if(Link->InputUp) {
            Link->InputUp = false;
            Link->Action = LA_WALKING;
            if(!isSolid(Link->X, Link->Y - 1)) Link->Y -= 1;
          }
          if(Link->InputLeft) {
            Link->InputLeft = false;
            Link->Action = LA_WALKING;
            if(!isSolid(Link->X - 1 , Link->Y)) Link->X -= 1;
          }
          if(Link->InputRight) {
            Link->InputRight = false;
            Link->Action = LA_WALKING;
            if(!isSolid(Link->X + 16, Link->Y)) Link->X += 1;
          }
        } else {
          if(on_ladder) {
            Link->Item[I_HOVERBOOTS] = has_hover;
            on_ladder = false;
          }
        }
      }
    }
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

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