Advertisement
jargon

Dungeon Input.bas

Feb 14th, 2021
3,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sub cinput(byref C as string,byref Proposed_X as integer,byref Proposed_Y as integer,byref Prior_X as integer,byref Prior_Y as integer)
  2.    
  3.     dim as string XM,YM
  4.  
  5.     C = INKEY  
  6.     XM = SPACE(0)
  7.     YM = SPACE(0)
  8.  
  9.     IF LEN(C) = 0 THEN
  10.         C = SPACE(1)
  11.     END IF
  12.    
  13.     IF C = CHR(27) THEN
  14.        
  15.         SCREEN 0, 0, 0, 0
  16.         WIDTH 80
  17.         COLOR 15, 9 ', 1
  18.         CLS
  19.         END
  20.    
  21.     END IF
  22.    
  23.     Prior_X = Proposed_X
  24.     Prior_Y = Proposed_Y
  25.  
  26.     key_routines keymap(), Proposed_X, Proposed_Y, c
  27.    
  28. end sub
  29.  
  30. sub key_routines(keymap() as keymap_type, byref Proposed_X as integer, byref Proposed_Y as integer, c as string)
  31.    
  32.     Proposed_X=Prior_X
  33.     Proposed_Y=Prior_Y
  34.    
  35.     dim as integer i=0,k=0
  36.    
  37.     for i=lbound(keymap,1) to ubound(keymap,1) step 1
  38.        
  39.         if instr(ucase(keymap(i).key),ucase(c))>0 then
  40.            
  41.             for k=lbound(keymap(i).instruct,1) to ubound(keymap(i).instruct,1) step 1
  42.    
  43.                 select case k
  44.                 case 0
  45.                     Proposed_X+=keymap(i).instruct(k)
  46.                 case 1
  47.                     Proposed_Y+=keymap(i).instruct(k)
  48.                 end select
  49.            
  50.             next k
  51.            
  52.         end if
  53.        
  54.     next i
  55.    
  56. end sub
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement