View Single Post
Old 24 February 2012, 00:50   #115
Ze Emulatron
Registered User

 
Join Date: Nov 2010
Location: Invercargill, New Zealand
Posts: 175
I don't know if you want to load your levels from text files and allow users to modify them but this is my example of AmigaBASIC code for reading in text from file, I use a slight variation on this for reading in highscores in my next game. You might be able to modify it to use in Blitz Basic if you want to load your levels from text files and allow users to modify them.

Example of file TOH

100,90,80,70,60,50,40,30,20,10


' CODE FOR IN PROGRAM

Code:
' ARRAY TO STORE SCORES
DIM SCOREZ (10)

' OPEN FILE "TOH" FOR READING
OPEN "TOH" FOR INPUT AS 1

' LOOP TO READ IN AMOUNT OF SCORES
FOR COUNT = 1 TO 10

  ' READ INPUT FROM OPEN FILE 1 INTO ARRAY
  INPUT# 1, SCOREZ (COUNT)

NEXT

' CLOSE FILE 1
CLOSE 1
Ze Emulatron is offline  
 
Page generated in 0.07840 seconds with 9 queries