Advertisement
Eeems

char_jump

Apr 18th, 2011
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. char_jump:
  2.    
  3.     ld a,(charJ)    ;get the switch for if char is jumping
  4.     or a    ;check if it is
  5.         ret nz  ;if it is return
  6.    
  7.     ld a,(charT+1)  ;get y
  8.     inc a   ;get y+1
  9.     inc a   ;get y+2
  10.     ld e,a
  11.    
  12.     ld a,(charT)    ;get x
  13.     ld d,a
  14.    
  15.     call Tile_value ;get tile properties of (x,y+2)
  16.     call TileType
  17.         jr z,_  ;if solid test position
  18.     cp 10       ;if ladder
  19.         jr z,_  ;test position
  20.        
  21.     inc d   ;check x+1
  22.    
  23.     call Tile_value ;get tile properties of (x+1,y-1)
  24.     call TileType
  25.         jr z,++_    ;if solid test x position
  26.     cp 10       ;if ladder
  27.         jr z,_  ;test x position
  28.        
  29.    
  30.     ret ;otherwise do normal stuff
  31.    
  32. _   ;test position
  33.     dec e   ;decrease y back to characters tile
  34.     getoffsetE  ;get tiles edge
  35.     ld e,a  ;store it back to d
  36.     getY    ;get the characters edge
  37.     add a,16
  38.     cp e    ;compare
  39.         jr nc,++_   ;if it is more then one past then it is right up against the edge, or it is in the tile
  40.  
  41. _   ;test x position
  42.     getoffsetD  ;get tiles edge
  43.     ld d,a  ;store it back to d
  44.     getX    ;get the characters edge
  45.     add a,8
  46.     cp d    ;compare
  47.         ret z   ;if it is more then one past then it is right up against the edge, or it is in the tile
  48.  
  49. _   ld a,(BlackMageStats+hover) ;get jump pleteu value
  50.     ld (charJ),a    ;store it
  51.     ld a,(BlackMageStats+jump)  ;store jump stats to a
  52.     ld (charJ+1),a  ;store that value to the jump counter
  53.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement