Zelda Classic Tutorials
 
 

Sideview Ladder

Zelda Classic includes a feature to enable gravity on certain screens, to simulate the sideview areas found in many Zelda games. However, a glaring omission from this feature is the ability to have ladders that Link can climb. This script allows you to have ladders like that.

Script

This script uses the Global OnStart Script. Please refer to that page for more details on how to use this.

These are the global variables

bool has_hover = false;
bool on_ladder = false;

This section is script body:

Show/Hide < code block hidden >
//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;
      }
    }
  }

This section is the function call:

ladder(98);

Function Call Arguments

  1. The Flag to track. Must be set. (Recommended to use flags 98-102)

Updates

  • July 30, 2008 - Modified the script to be... well, better overall. No longer uses any globals or the hover boots. Gods, I don't know why I used them in the first place. Also added the ability to move left and right.
  • July 30, 2008 - I am an idiot, and forgot what exactly I was doing with the hover boots. Re-added the globals.

Notes

  • While on the ladder, Link cannot jump. Not from a Roc's feather, and not from anything else. This is because the game does not realize Link is a solid surface (since, really, he isn't).

Screen shots

Look ma, no gravity!

Climbing across the cieling

Now I can jump too!