Code: Select all
Const XST=5
Const YST=5
w=250
h=150
SCREEN w*2,h*2,0,1
SCREEN w,h,0,2
Type SEL
Field x
Field y
Field c
Field id
Field txt As String
EndType
Type PAL
Field x As Float
Field y As Float
Field kx As Float
Field ky As Float
Field s
Field is
EndType
sss=h/20
pa.PAL=New(PAL)
pa\x=0
pa\y=h/2
pa\s=sss
ukko=MakeImage(6,4)
mouse=MakeImage(6,6)
start=Timer ()
font=LoadFont("courier new",12)
SetFont font
logo=MakeImage(TextWidth("The Titans 1.0"),TextHeight("The Titans 1.0"))
logo2=MakeImage(TextWidth("The Titans 1.0"),TextHeight("The Titans 1.0"))
teks=TextHeight("")-4
d=3
DrawToImage mouse
Color 1,1,1
For i=0 To 6
Line 0,0,6-i,6
Next i
Color 255,170,0
Line 0,0,6,6
Line 0,0,0,6
Line 0,5,5,5
DrawToImage logo
Color 42*1.2,42*1.5,42*1.8
Text 0,0,"The Titans 1.0"
DrawToImage logo2
Color 127,127*1.5,127*2
Text 0,0,"The Titans 1.0"
DrawToScreen
ResizeImage logo,TextWidth("The Titans 1.0")*3,TextHeight("The Titans 1.0")*3
ResizeImage logo2,TextWidth("The Titans 1.0")*3,TextHeight("The Titans 1.0")*3
RotateImage mouse,90
Type BOXIT
Field x As Float
Field spe As Float
Field le
Field id
EndType
Type TBOX
Field x As Float
Field spe As Float
Field y As Float
Field m
EndType
Type STAR
Field x As Float
Field y As Float
Field yy As Float
Field is2
Field spe As Float
Field jako As Float
EndType
SaveImage ukko,"ukko.png"
ukko1=LoadAnimImage("ukko.png",3,4,0,2)
f=OpenToEdit("score.txt")
rpist=ReadInt(f)
CloseFile f
SAFEEXIT OFF
ShowMouse OFF
ms=1
mx=MouseX()
my=MouseY()
vy=ImageHeight(logo)+3
music=1
debug=0
tausta=1
bpm=130
askel=100
Locate 0,vy
For i=1 To 5
se.SEL=New(SEL)
se\x=w/2
se\y=vy+i*(teks+6)
se\c=255
se\id=i
Select i
Case 1
se\txt="Start"
Case 2
se\txt="Options"
Case 3
se\txt="About"
Case 4
se\txt="Credits"
Case 5
se\txt="Quit"
EndSelect
Next i
menu:
If SoundPlaying(mus) Then
StopSound mus
EndIf
If FileExists("menumusic.xm") And music=1 Then
mus=PlaySound("menumusic.xm",50)
EndIf
Repeat
If FileExists("menumusic.Mid") And SoundPlaying(mus)=0 And music=1 Then
mus=PlaySound("menumusic.Mid",50)
EndIf
If debug=0 Then
ClearText
EndIf
DrawImage logo,w/2-ImageWidth(logo)/2,2
DrawImage logo2,w/2-ImageWidth(logo2)/2-3,-1
For se.SEL=Each SEL
If se\id<6 Then
se\c=127-Min(85,Distance(se\x/(w/40),se\y,mx/(w/40),my)*4)
Color 0.2*se\c,0.2*se\c*1.5,0.2*se\c*2
Box se\x-2-TextWidth(se\txt)/2,se\y-d*2,TextWidth(se\txt)+4,TextHeight(se\txt),1
Color se\c,se\c*1.5,se\c*2
Box se\x-2-TextWidth(se\txt)/2,se\y-d*2,TextWidth(se\txt)+4,TextHeight(se\txt),0
CenterText se\x,se\y,se\txt,2
If Distance(0,se\y,0,my)<8 Then
If MouseHit(1) Or KeyHit(28) Then
If debug=1 Then
AddText se\txt
EndIf
Select se\id
Case 1
Goto game
Case 2
Goto optio
Case 3
Goto about
Case 4
Goto credits
Case 5
Goto loppu
EndSelect
EndIf
EndIf
EndIf
Next se
mx=MouseX()
my=MouseY()
Color 120,120,120
Line 0,vy,w,vy
DrawImage mouse,MouseX(),MouseY()
DrawScreen
Until KeyHit(1)
Goto loppu
game:
Const PAINOVOIMA = -0.1
yPlus#=0
SCREEN 320,240,0,cbFullScreen
SetWindow "The Titans 1.0",3 'suurenna ruudulle
FrameLimit 40
kenttä=LoadMap ("Media\testmap.til","Media\tileset.bmp")
PositionObject kenttä,0,50
PlayObject kenttä,0,0,0.5
'lataa animaatiosarja oikealle, maskaa ja piilota se
oikea=LoadAnimObject("Media\zerorun1.bmp",47,51,0,13)
MaskObject oikea,cbMagenta
ShowObject oikea,OFF
ObjectRange oikea,30,51 'tämä pitää asettaa kaikkiin
'sama vasemmalle
vasen=LoadAnimObject("Media\zerorun2.bmp",47,51,0,13)
MaskObject vasen,cbMagenta
ShowObject vasen,OFF
ObjectRange vasen,30,51 'tämä pitää asettaa kaikkiin
pelihahmo=CloneObject(oikea)
SetupCollision pelihahmo,kenttä,1,4,2
ObjectRange pelihahmo,30,51 'tämä pitää asettaa kaikkiin
Repeat
If RightKey() Then
PaintObject pelihahmo,oikea
If maassa Then PlayObject pelihahmo,2,11,0.25
vauhti=2
ElseIf LeftKey() Then
PaintObject pelihahmo,vasen
If maassa Then PlayObject pelihahmo,2,11,0.25
vauhti=-2
Else
PlayObject pelihahmo,0
EndIf
'liikuta pelihahmoa
TranslateObject pelihahmo,vauhti,yPlus#
yPlus=yPlus+PAINOVOIMA
UpdateGame 'päivitä törmäys
CloneCameraPosition pelihahmo 'liimaa kamera
maassa=0 'ilmassa jollei toisin käy ilmi
törmäykset=CountCollisions(pelihahmo)
'katsotaan tärmätäänkö kattoon tai lattiaan
For i=1 To törmäykset
If GetCollision(pelihahmo,i)=kenttä
'lattia
If CollisionAngle(pelihahmo,i)=90 Then
yPlus#=-1
maassa=1 'jalat on maassa
EndIf
'katto
If CollisionAngle(pelihahmo,i)=270 Then
yPlus#=-1
EndIf
EndIf
Next i
'jos ollaan ilmassa, näytä toisenlainen kuva
If törmäykset=0 Then PlayObject pelihahmo,12,0
'HYPPY (vain jos jalat maassa)
If KeyHit(cbKeySpace) And maassa Then
yPlus#=4.5 'voimaa ylös päin
EndIf
DrawScreen
Forever
Goto menu
optio:
ClearMouse
For i=6 To 8
se.SEL=New(SEL)
se\x=w/2
se\y=vy+(i-5)*(teks+6)
se\c=255
se\id=i
Select i
Case 6
se\txt="Music"
Case 7
se\txt="Debug"
Case 8
se\txt="Background"
EndSelect
Next i
Repeat
For se.SEL=Each SEL
If se\id>5 Then
se\c=127-Min(85,Distance(se\x/10,se\y,mx/10,my)*4)
Select se\id
Case 6
Color 0.2*se\c,0.2*se\c*1.5,0.2*se\c*2
Box se\x-2-TextWidth(se\txt+" "+music)/2,se\y-d*2,TextWidth(se\txt+" "+music)+4,TextHeight(se\txt),1
Color se\c,se\c*1.5,se\c*2
Box se\x-2-TextWidth(se\txt+" "+music)/2,se\y-d*2,TextWidth(se\txt+" "+music)+4,TextHeight(se\txt),0
CenterText se\x,se\y,se\txt+" "+music,2
Case 7
Color 0.2*se\c,0.2*se\c*1.5,0.2*se\c*2
Box se\x-2-TextWidth(se\txt+" "+debug)/2,se\y-d*2,TextWidth(se\txt+" "+debug)+4,TextHeight(se\txt),1
Color se\c,se\c*1.5,se\c*2
Box se\x-2-TextWidth(se\txt+" "+debug)/2,se\y-d*2,TextWidth(se\txt+" "+debug)+4,TextHeight(se\txt),0
CenterText se\x,se\y,se\txt+" "+debug,2
Case 8
Color 0.2*se\c,0.2*se\c*1.5,0.2*se\c*2
Box se\x-2-TextWidth(se\txt+" "+tausta)/2,se\y-d*2,TextWidth(se\txt+" "+tausta)+4,TextHeight(se\txt),1
Color se\c,se\c*1.5,se\c*2
Box se\x-2-TextWidth(se\txt+" "+tausta)/2,se\y-d*2,TextWidth(se\txt+" "+tausta)+4,TextHeight(se\txt),0
CenterText se\x,se\y,se\txt+" "+tausta,2
EndSelect
If Distance(0,se\y,0,my)<8 Then
If MouseHit(1) Or KeyHit(28) Then
If debug=1 Then
AddText se\txt
EndIf
Select se\id
Case 6
music+1
If music>1 Then music=0
Case 7
debug+1
If debug>1 Then debug=0
Case 8
tausta+1
If tausta>1 Then tausta=0
EndSelect
EndIf
EndIf
EndIf
Next se
If debug=0 Then
ClearText
EndIf
mx=MouseX()
my=MouseY()
DrawImage mouse,MouseX(),MouseY()
DrawScreen
Until KeyHit(1)
Goto menu
about:
Repeat
Color 42*1.2,42*1.5,42*1.8
CenterText w/2,10+teks,"About"
CenterText w/2,10+teks*2,"Steer left and right arrows"
CenterText w/2,10+teks*3,"jump to a space"
CenterText w/2,10+teks*4,""
CenterText w/2,10+teks*5,""
CenterText w/2,10+Teks*6,"(c)Gameteam inch."
Color 30,30,30
Text w-TextWidth("esc To go back"),h-teks,"Esc t"+"o go back"
DrawScreen
If debug=0 Then
ClearText
EndIf
Until KeyHit(1)
Goto menu
credits:
Repeat
Color 42*1.2,42*1.5,42*1.8
CenterText w/2,10+teks," Code : Game Team"
CenterText w/2,10+teks*2," Musics : Game Team"
CenterText w/2,10+teks*3,"Graphics: Game Team"
Color 30,30,30
Text w-TextWidth("esc To go back"),h-teks,"Esc t"+"o go back"
DrawScreen
If debug=0 Then
ClearText
EndIf
Until KeyHit(1)
Goto menu
loppu:
f=OpenToWrite("score.txt")
WriteInt f,rpist
CloseFile f
DeleteFile "ukko.png"
End
Return