Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dim as long level
- level=4
- declare sub loadpack(level as long)
- declare function nconcat(n as long,d as long) asec string
- declare Sub Intro(level as long)
- function nconcat(n as long,d as long) as string
- dim as string sn
- sn=str(n)
- while left(sn,1)=chr(32):sn=right(sn,len(sn)-1):wend
- if len(sn)<d then sn=string(d-len(sn),"0")+sn
- nconcat=sn
- end function
- Sub Intro(level as long)
- color 15,1
- dim as string gamename,levelname,rating,datapack
- dim as long levelnum,packexists
- dim as long filemode
- datapack="./datapack/level-"+nconcat(level,2)
- filemode=freefile
- packexists=open(datapack+"/summary.txt" for input as #filemode)
- if packexists then
- gamename="Sparked x86"
- levelnum=0
- levelname="Placeholder"
- rating="Debug Mode"
- else
- input #filemode,gamename
- input #filemode,levelnum,levelname
- input #filemode,rating
- end if
- close #filemode
- cls : randomize()
- locate 1,1 : print datapack
- locate 5,34 : print gamename;
- locate 7,28 : print "LEVEL "+nconcat(levelnum,2)+": "+levelname;
- locate 9,28 : print "RATING: "+rating;
- locate 15,24 : print "PUSH THE <ENTER> KEY TO START";
- while getkey()<>13 : wend
- end sub
- declare sub loadpack(level as long)
- dim as string gamename,levelname,rating,datapack
- dim as long levelnum,packexists
- dim as string head,buffer,handle
- dim as long o
- dim as long filemode
- dim as long wid,hei
- wid=0
- hei=0
- buffer=space(0)
- o=0
- filemode=0
- head=space(0)
- datapack="./datapack/level-"+nconcat(level,2)
- filemode=freefile
- packexists=open(datapack+"/sprites.txt" for input as #filemode)
- if packexists then
- gamename="Sparked x86"
- levelnum=0
- levelname="Placeholder"
- rating="Debug Mode"
- else
- do while not(eof(filemode))
- line input #filemode,buffer
- o=instr(1,buffer,"( ")
- if o>0 then
- head=left(buffer,o-1)
- if head="DeclareGlobalImage" then
- buffer=mid(buffer,len(head)+2)
- o=instr(1,buffer," , ")
- handle=left(buffer,o-1)
- buffer=mid(buffer,len(handle)+3)
- o=instr(1,buffer," , ")
- wid=left(buffer,o-1)
- buffer=mid(buffer,len(wid)+3)
- o=instr(1,buffer," , ")
- hei=left(buffer,o-1)
- buffer=mid(buffer,len(hei)+3)
- if buffer="_" then exit do
- else
- do while len(buffer)>0
- o=instr(1,buffer,space(2))
- if o=1 then
- buffer=mid$(buffer,o+1)
- else
- exit do
- end if
- o=instr(1,buffer,",")
- if o>0 then
- pix=left(buffer,o-1)
- buffer=mid(buffer,len(pix)+1)
- elseif buffer=" , _"
- buffer=space(0)
- elseif buffer=" )"
- buffer=space(0)
- end if
- loop
- end if
- end if
- loop
- end if
- close #filemode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement