Before I get to the code (below), I need to explain a few things. This program will not run without a media file called "square.bmp". Just go into MSPaint, and make a 26*26 pixel square and save it as "square.bmp" in the same directory as the program. What this program does is, allows you to move the square around with the arrowkeys, and when you press "s" saves the square's x and y positions. When you end the program and press "l", the program loads your previous save file, and the square will be right where you saved it last time. Seems simple now, but it will help in the long run (for those of you who plan on making long games and want save files).
`Saving and Loading sample
`Created by Delfir on 11/23/05
set display mode 800,600,16
loaded=0
game_start=0
repeat
Set text size 48
center text 400,100, "Press N for new game"
center text 400,300, "Press L to load game"
center text 400,500, "In game, press S to save game"
if inkey$()="n" or inkey$()="N" then game_start=1
if inkey$()="l" or inkey$()="L"
if file exist("data 1.square")=1
open to read 1,"data 1.square"
read file 1,x
read file 1,y
close file 1
game_start=1
loaded=1
else
print "file does not exist"
wait key
cls
endif
endif
until game_start=1
load bitmap "square.bmp",1
get image 1,0,0,26,26
delete bitmap 1
if loaded=0
x=400
y=300
endif
do
cls
sprite 1,x,y,1
if upkey()=1 then dec y,3
if downkey()=1 then inc y,3
if leftkey()=1 then dec x,3
if rightkey()=1 then inc x,3
if x<=0 then x=0
if x>=774 then x=774
if y<=0 then y=0
if y>=574 then y=574
if inkey$()="s" or inkey$()="S"
if file exist("data 1.square")=1
delete file "data 1.square"
endif
open to write 1,"data 1.square"
write file 1,x
write file 1,y
close file 1
repeat
cls
Center text 300,200, "Game saved. Press"
Center text 300,400, "return to continue."
until returnkey()=1
endif
loop
edit: thanks
Legendary>Heroic>Normal>Easy