Advertisement
jargon

Sparked x86 Level Intro from datapack

Sep 3rd, 2020
4,346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function nconcat(n as long,d as long) as string
  2.     dim as string sn
  3.     sn=str(n)
  4.     while left(sn,1)=chr(32):sn=right(sn,len(sn)-1):wend
  5.     if len(sn)<d then sn=string(d-len(sn),"0")+sn
  6.     nconcat=sn
  7. end function
  8. Sub Intro(level as long)
  9.     color 15,1
  10.     dim as string gamename,levelname,rating,datapack
  11.     dim as long levelnum,packexists
  12.  
  13.     dim as long filemode
  14.     datapack="./datapack/level-"+nconcat(level,2)+".txt"
  15.    
  16.     packexists=open(datapack for input as #filemode)
  17.    
  18.     if packexists=1 then
  19.         input #filemode,gamename
  20.         input #filemode,levelnum,levelname
  21.         input #filemode,rating
  22.     else
  23.         gamename="Sparked x86"
  24.         levelnum=0
  25.         levelname="Placeholder"
  26.         rating="Debug Mode"
  27.     end if
  28.  
  29.     close #filemode
  30.        
  31.     cls : randomize()
  32.    
  33.     locate 1,1 : print datapack+" ("+nconcat(packexists,4)+","+nconcat(filemode,4)+")"
  34.    
  35.     locate  5,34 : print gamename;
  36.     locate  7,28 : print "LEVEL "+nconcat(levelnum,2)+": "+levelname;
  37.     locate  9,28 : print "RATING: "+rating;
  38.     locate 15,24 : print "PUSH THE <ENTER> KEY TO START";
  39.    
  40.     while getkey()<>13 : wend
  41.  
  42. end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement