I finished a presentation for my Social Studies class. It was buggy, but finished. It was also obnoxiously huge because of the huge bitmaps and wavs I used as a naive n00b. So here's the source:
`-------------------------------------------------------------
`Michael Bartnett, 10/29/03, Social Studies p5
`The American Flyer v1.0
`-------------------------------------------------------------
startover:
rem declare variables
dim trspeed(0)
trspeed(0)=300
dim trainX(0)
dim trainY(0)
trainX(0)=670
trainY(0)=155
Xadj=0
Yadj=0
trspeed=1
dim trsize(0)
dim frametimer(0)
frametimer(0)=timer()
dim trframe(0)
trframe=1
dim stopX(5)
dim stopY(5)
dim nextstop(0)
nextstop(0)=1
stopX(0)=536 : stopY(0)=124
stopX(1)=464 : stopY(1)=116
stopX(2)=402 : stopY(2)=110
stopX(3)=325 : stopY(3)=116
stopX(4)=244 : stopY(4)=132
stopX(5)=72 : stopY(5)=162
dim citySTR$(5)
citySTR$(0)="NEW YORK CITY"
citySTR$(1)="CLEVELAND"
citySTR$(2)="CHICAGO"
citySTR$(3)="OMAHA"
citySTR$(4)="DENVER"
citySTR$(5)="SAN FRANCISCO"
dim red(0)
dim white(0)
dim black(0)
dim offX(0)
dim offY(0)
offX(0)=22
offY(0)=16
dim resizeX(0)
dim resizeY(0)
resizeX(0)=45
resizeY(0)=27
dim music$(5)
music$(0)="media\New York, New York.wav"
music$(1)="media\Cleveland Rocks.wav"
music$(2)="media\Chicago.wav"
music$(3)="media\Take the 'A' Train.wav"
music$(4)="media\Perdido.wav"
music$(5)="media\Swing Inc.wav"
dim tminc(0)
dim timestr$(9)
timestr$(0)="Depart from New York City--October 29, 6:50 PM ZULU"
timestr$(1)="Arrive at Cleveland--October 30, 2:15 PM ZULU, 9:15 AM Cleveland Time"
timestr$(2)="Depart from Cleveland--October 30, 1:15 AM ZULU"
timestr$(3)="Arrive at Chicago--October 31, 1:30 AM ZULU, 7:30 AM Chicago Time"
timestr$(4)="Depart from Chicago--October 31, 9:30 AM ZULU"
timestr$(5)="Arrive at Omaha--November 1, 6:10 AM ZULU, 12:10 AM Omaha Time"
timestr$(6)="Depart from Omaha--November 1, 10:10 AM ZULU"
timestr$(7)="Arrive at Denver--November 2, 8:20 AM ZULU, 1:20 AM Denver Time"
timestr$(8)="Depart from Denver--November 2, 4:20 PM ZULU"
timestr$(9)="Arrive at San Francisco--November 4, 1:45 PM ZULU, 5:45 AM San Francisco Time"
ScreenSetup()
LoadFrames()
remstart
Main Loop
remend
Startit()
NewYork()
do
cls
DrawGraphics()
AnimateSprites()
set text size 54
set text font "Arial"
set text to italic
z=text height("THE AMERICAN FLYER v1.0")
center text 320,350, "THE AMERICAN FLYER v1.0"
set text size 18
center text 320,z+380, "COPYRIGHT 2003 Michael Bartnett"
sync
loop
end
`----------------------------------------------------------------------------
`------------------------------------FUNCTIONS-------------------------------
`----------------------------------------------------------------------------
function ScreenSetup()
set display mode 640,480,32
sync on
sync rate 80
load image "media\usmap.bmp",9
load image "media\citysprite.bmp",10
load image "media\newyork.bmp",11
load image "media\cleveland.bmp",12
load image "media\chicago.bmp",13
load image "media\omaha.bmp",14
load image "media\denver.bmp",15
load image "media\sanfrancisco.bmp",16
load sound music$(0),1
load sound music$(1),2
voladj=get sound volume(2)/2
set sound volume 2,voladj
load sound music$(2),3
load sound music$(3),4
load sound music$(4),5
load sound music$(5),6
black(0)=rgb(0,0,0)
white(0)=rgb(255,255,255)
red(0)=rgb(255,0,0)
set window title "The American Flyer"
endfunction
function DrawGraphics()
paste image 9, 0,0
for i= 0 to 5
x=stopX(i)
y=stopY(i)
sprite i+2,x,y,10
offset sprite i+2, 10,7
hide sprite i+2
next i
endfunction
function AnimateSprites()
timer2=timer()
elapsed=timer2-frametimer(0)
fr=fr+elapsed
if elapsed>100
frametimer(0)=timer()
trframe(0)=trframe(0)+1
endif
if fr>trspeed(0)
RePlot()
fr=0
endif
if trframe(0)>8 then trframe(0)=1
sprite 1, trainX(0),trainY(0),trframe(0)
size sprite 1, resizeX(0),resizeY(0)
offset sprite 1,offX(0),offY(0)
ink red(0),black(0)
circle trainX(0),trainY(0),24
ink white(0),black(0)
CheckArrival()
endfunction
function LoadFrames()
for i= 1 to 8
string$="media\"+str$(i)+".bmp"
load image string$, i
next i
endfunction
function CheckArrival()
stop=nextstop(0)+1
if stop> 7 then Endit()
hit=sprite hit(1,stop)
if hit>0
trframe(0)=1
nextstop(0)=nextstop(0)+1
CitySelect()
endif
endfunction
function RePlot()
if nextstop(0)=2
xadj1=-1
yadj1=0
xbuf1=xbuf1+xadj1
if xbuf1<-8
xadj1=-1
yadj1=-1
xbuf1=0
endif
trainX(0)=trainX(0)+xadj1 : trainY(0)=trainY(0)+yadj1
exitfunction
endif
if nextstop(0)=3
xadj2=-1
yadj2=0
xbuf2=xbuf2+xadj2
if xbuf2<-10
xadj2=-1
yadj2=-1
xbuf2=0
endif
trainX(0)=trainX(0)+xadj2 : trainY(0)=trainY(0)+yadj2
exitfunction
endif
if nextstop(0)=4
xadj3=-1
yadj3=0
xbuf3=xbuf3+xadj1
if xbuf3<-12
xadj3=-1
yadj3=1
xbuf3=0
endif
trainX(0)=trainX(0)+xadj3 : trainY(0)=trainY(0)+yadj3
exitfunction
endif
if nextstop(0)=5
xadj4=-1
yadj4=0
xbuf4=xbuf4+xadj4
if xbuf4<-4
xadj4=-1
yadj4=1
xbuf4=0
endif
trainX(0)=trainX(0)+xadj4 : trainY(0)=trainY(0)+yadj4
exitfunction
endif
if nextstop(0)=6
xadj5=-1
yadj5=0
xbuf5=xbuf5+xadj5
if xbuf5<-5
xadj5=-1
yadj5=1
xbuf5=0
endif
trainX(0)=trainX(0)+xadj5 : trainY(0)=trainY(0)+yadj5
exitfunction
endif
endfunction
function PrintTimes()
string0$="New York Time: "
string1$="Cleveland Time: "
string2$="Chicago Time: "
string3$="Omaha Time: "
string4$="Denver Time: "
string5$="San Francisco Time: "
pa$="AM"
x=100 : y=300
w=text width(string0$)+2
h=text height(string0$)+2
if tminc(0)=0
string$="8:15 AM"
text x,y, string0$+string$
text x,y+1*h, string1$+string$
string$="7:15 AM"
text x,y+2*h, string1$+string$
text x,y+3*h, string1$+string$
string$="6:15 AM"
text x,y+4*h, string1$+string$
string$="5:15 AM"
text x,y+5*h, string1$+string$
endif
if tminc(0)=1
string$="9:30 PM"
text x,y, string0$+string$
text x,y+1*h, string1$+string$
string$="8:30 PM"
text x,y+2*h, string1$+string$
text x,y+3*h, string1$+string$
string$="7:30 PM"
text x,y+4*h, string1$+string$
string$="6:30 PM"
text x,y+5*h, string1$+string$
endif
if tminc(0)=2
string$="1:10 AM"
text x,y, string0$+string$
text x,y+1*h, string1$+string$
string$="12:10 AM"
text x,y+2*h, string1$+string$
text x,y+3*h, string1$+string$
string$="11:10 PM"
text x,y+4*h, string1$+string$
string$="10:10 PM"
text x,y+5*h, string1$+string$
endif
if tminc(0)=3
string$="3:20 AM"
text x,y, string0$+string$
text x,y+1*h, string1$+string$
string$="2:20 AM"
text x,y+2*h, string1$+string$
text x,y+3*h, string1$+string$
string$="1:20 AM"
text x,y+4*h, string1$+string$
string$="12:20 AM"
text x,y+5*h, string1$+string$
endif
if tminc(0)=4
string$="8:45 AM"
text x,y, string0$+string$
text x,y+1*h, string1$+string$
string$="7:45 AM"
text x,y+2*h, string1$+string$
text x,y+3*h, string1$+string$
string$="6:45 AM"
text x,y+4*h, string1$+string$
string$="5:45 AM"
text x,y+5*h, string1$+string$
endif
endfunction
function Startit()
cls
print "WELCOME ABOARD THE AMERICAN FLYER!!!"
print "I hope you'll apologize for the somewhat limited graphics capabilities in the areas where text"
print "is being displayed, there were a few bumps, as in...Mount Everest bumps, in the physics and"
print "graphics calculating portion of the engine. Which reminds me, every game runs off an engine, most"
print "often aspiring game developers (like myself) write their own program engines which dictate the"
print "skeleton of a program, allowing you to then add the 'muscle', or media, concept, etc. This engine"
print "is called the 'Steam Engine'."
print
print
print "You are about to experience the American Flyer, You will need to know a few things before we start"
print
print "1. Please keep all hands, feet, heads, other body parts, inside the train at all times."
print "2. Please stay out of the Pullman Cars unless you have a lot of money to give us."
print "3. No pennies allowed on the train at any time."
print "4. When confronted with an annoying information sheet featuring pictures of our current stop, or"
print "photographs of 'motion picture' stars, if you want to get rid of the information sheet,"
print " gently press any key."
print "5. The default speed for the train is 300 milliseconds per pixels, or .3 seconds per pixel."
input "Would you like to change this now? A simple 'yes' or 'no' will be fine.>>>", yn$
print
if yn$="yes"
print "How fast would you like the train to go?"
input "(how many milliseconds for every pixel? one whole integer please, bigger=slower)>>>", speed
if speed<1
print "The train must go SOMWHERE!"
print "Unfortunately because computers are not the least intelligent being in this universe,"
print "the default speed will be the speed that the trains travels."
else
print "Thank you!"
trspeed(0)=speed
endif
endif
endfunction
function Endit()
print "This Concludes Your Journey On The American Flyer, Have a Good Trip"
undim trainX(0)
undim trainY(0)
undim trsize(0)
undim frametimer(0)
undim trframe(0)
undim stopX(5)
undim stopY(5)
undim nextstop(0)
undim citySTR$(5)
undim red(0)
undim white(0)
undim black(0)
undim offX(0)
undim offY(0)
undim resizeX(0)
undim resizeY(0)
undim music$(5)
undim tminc(0)
undim timestr$(9)
print
print "Designer/Audio Editing/Graphics Editing/Source Code/Physics/The Whole Enchilada"
print "Michael Bartnett"
print
print "Co Designer"
print "Mr. Stroud"
print
print "Special Thanks To:"
print "AnimFactory, for the Train"
print "Jasc, for Paint Shop Pro 7 Demo and Animation Shop"
print "Microsoft for a crum-I mean nice OS and small editing programs"
print "Ian Hunter for 'Cleveland Rocks'"
print "Frank Sinatra for 'New York, New York'"
print "Frank Sinatra Kendor Music Recordings for 'Chicago' arrangement"
print "Tony Bennet and Some Person On The Internet for 'I Left My Heart In San Francisco' arrangement"
print "Duke Ellington for Take the 'A' Train and 'Perdido'"
print "Some Person On The Internet2 for Map of United States"
print "The Game Creators Forum for all the help, thanks dudes!"
print "DarkBASIC Software for DarkBASIC Classic, I love you guys....."
wait key
end
endfunction
`--------------------------------------CITY-FUNCTIONS-------------------------------
function CitySelect()
select nextstop(0)
case 3
Cleveland()
exitfunction
endcase
case 4
Chicago()
exitfunction
endcase
case 5
Omaha()
exitfunction
endcase
case 6
Denver()
exitfunction
endcase
case 7
SanFrancisco()
exitfunction
endcase
endselect
endfunction
function NewYork()
cls
paste image 11, 0,0
play sound 1
wait key
stop sound 1
cls
for i= 0 to 0
print timestr$(i)
next i
PrintTimes()
wait key
cls
trainX(0)=stopX(0) : trainY(0)=stopY(0)
nextstop(0)=nextstop(0)+1
tminc(0)=tminc(0)+1
endfunction
function Cleveland()
delete sprite 1
cls
paste image 12,0,0
play sound 2
wait key
stop sound 2
cls
for i=0 to 2
print timestr$(i)
next i
PrintTimes()
wait key
cls
trainX(0)=stopX(1) : trainY(0)=stopY(1)
sprite 1, trainX(0),trainY(0),trframe(0)
size sprite 1, resizeX(0),resizeY(0)
offset sprite 1,offX(0),offY(0)
wait 100
tminc(0)=tminc(0)+1
endfunction
function Chicago()
delete sprite 1
cls
paste image 13,0,0
`play sound 3
wait key
`stop sound 3
cls
for i=0 to 4
print timestr$(i)
next i
PrintTimes()
wait key
cls
trainX(0)=stopX(2) : trainY(0)=stopY(2)
sprite 1, trainX(0),trainY(0),trframe(0)
size sprite 1, resizeX(0),resizeY(0)
offset sprite 1,offX(0),offY(0)
wait 100
tminc(0)=tminc(0)+1
endfunction
function Omaha()
delete sprite 1
cls
paste image 14,0,0
play sound 4
wait key
stop sound 4
cls
for i=o to 6
print timestr$(i)
next i
PrintTimes()
wait key
cls
trainX(0)=stopX(3) : trainY(0)=stopY(3)
sprite 1, trainX(0),trainY(0),trframe(0)
size sprite 1, resizeX(0),resizeY(0)
offset sprite 1,offX(0),offY(0)
wait 100
tminc(0)=tminc(0)+1
endfunction
function Denver()
delete sprite 1
cls
paste image 15,0,0
play sound 5
wait key
stop sound 5
cls
for i=0 to 8
print timestr$(i)
next i
PrintTimes()
wait key
cls
trainX(0)=stopX(4) : trainY(0)=stopY(4)
sprite 1, trainX(0),trainY(0),trframe(0)
size sprite 1, resizeX(0),resizeY(0)
offset sprite 1,offX(0),offY(0)
wait 100
tminc(0)=tminc(0)+1
endfunction
function SanFrancisco()
delete sprite 1
paste image 16,0,0
play sound 6
wait key
stop sound 6
cls
PrintTimes()
wait key
cls
Endit()
endfunction
You basically watch a train go across a map of the USA and it stops at different historical stops along the way, plays a song that is befitting of it (ie: Frank Sinatra's Chicago or New York, New York), tells you about it, then moves on to the next stop.
Crazy Donut Productions
Current Project: A Redneck game