Code: Select all
SCREEN 1024,768,16,0
valikko=LoadFont("arial",25,ON,OFF,OFF)
SetFont valikko
music=LoadSound("sounds\menu.mp3")
pic=LoadImage("images\menu.png")
hiiri=LoadObject("images\hiiri.png")
MaskObject hiiri,255,0,255
PlaySound music
aloitus=0
Repeat
DrawImage pic,0,0
If uusipeli(10,30,"New Game") Then //Uusi peli
DeleteSound music
paikka=1
Cls
Goto Peli
EndIf
If lataapeli(10,60,"Load Game") Then //
DeleteSound music
Cls
Goto Peli
EndIf
If asetukset(10,90,"Settings") Then //Asetukset
ClearText
Goto Asetukset
EndIf
If lopeta2(10,120,"Exit") Then //Lopeta
End
EndIf
ScreenPositionObject hiiri,MouseX(),MouseY()
DrawScreen
Forever
//Uusi peli---------------------------------------------------------
Function uusipeli(reunaX,reunaY,txt$)
clr=1
x = TextWidth(txt$)
y = TextHeight(txt$)
Color 0,0,0
If MouseX()<reunaX+x+6 And MouseX()>reunaX And MouseY()<reunaY+y+6 And MouseY()>reunaY Then
If MouseHit(1) Then paalla=True
If clr=1 Then Color 255,0,0
Else
paalla=False
EndIf
Text reunaX+3,reunaY+3,txt$
Return paalla
End Function
//Lataa peli----------------------------------------------------------
Function lataapeli(reunaX,reunaY,txt$)
clr=1
x = TextWidth(txt$)
y = TextHeight(txt$)
Color 0,0,0
If MouseX()<reunaX+x+6 And MouseX()>reunaX And MouseY()<reunaY+y+6 And MouseY()>reunaY Then
If MouseHit(1) Then paalla=True
If clr=1 Then Color 255,0,0
Else
paalla=False
EndIf
Text reunaX+3,reunaY+3,txt$
Return paalla
End Function
//Asetukset-----------------------------------------------------------
Function asetukset(reunaX,reunaY,txt$)
clr=1
x = TextWidth(txt$)
y = TextHeight(txt$)
Color 0,0,0
If MouseX()<reunaX+x+6 And MouseX()>reunaX And MouseY()<reunaY+y+6 And MouseY()>reunaY Then
If MouseHit(1) Then paalla=True
If clr=1 Then Color 255,0,0
Else
paalla=False
EndIf
Text reunaX+3,reunaY+3,txt$
Return paalla
End Function
//Lopeta--------------------------------------------------------------
Function lopeta2(reunaX,reunaY,txt$)
clr=1
x = TextWidth(txt$)
y = TextHeight(txt$)
Color 0,0,0
If MouseX()<reunaX+x+6 And MouseX()>reunaX And MouseY()<reunaY+y+6 And MouseY()>reunaY Then
If MouseHit(1) Then paalla=True
If clr=1 Then Color 255,0,0
Else
paalla=False
EndIf
Text reunaX+3,reunaY+3,txt$
Return paalla
End Function
//PELI-----------------------------------------------------------------
Peli:
FrameLimit 60
arial=LoadFont("arial")
SetFont arial
If paikka=1 Then
noob_island=LoadMap("maps\noob_island.til","maps\tileset_outdoor1.png")
MaskObject noob_island,255,0,255
EndIf
alalaita=LoadImage("images\toolbar.png")
oikealle=LoadAnimObject("objects\lehmä_oikea.png",30,25,0,2)
ShowObject oikealle,OFF
vasemmalle=LoadAnimObject("objects\lehmä_vasen.png",30,25,0,2)
ShowObject vasemmalle,OFF
hahmo=CloneObject(oikealle)
SetupCollision hahmo,noob_island,1,4,2
PositionObject hahmo,-750,-720
ObjectOrder hiiri,1
CameraFollow hahmo,1,25
progress=0
Repeat
If LeftKey() Then
PaintObject hahmo,vasemmalle
PlayObject hahmo,0,2,0.5,OFF
TranslateObject hahmo,-3,0
ElseIf RightKey() Then
PaintObject hahmo,oikealle
PlayObject hahmo,0,2,0.5,OFF
TranslateObject hahmo,3,0
Else
PlayObject hahmo,0
EndIf
If DownKey() Then
TranslateObject hahmo,0,-3
EndIf
If UpKey() Then
TranslateObject hahmo,0,3
EndIf
ScreenPositionObject hiiri,MouseX(),MouseY()
DrawGame
DrawImage alalaita,0,625
DrawToImage alalaita
Color 255,255,255
Box 5,25,400,110
DrawToScreen
If progress=0 Then
DrawToImage alalaita
Color 0,0,0
Text 7,-27,"Welcome to the world of ************. Before we can let"
Text 7,-37,"you save our world from terrifying lord *********, you"
Text 7,-47,"must complete your training. Use arrow keys to move."
Text 7,-57,"Follow the path to find your next master."
Text 7,-77,"OBJECT: Find your next master."
DrawToScreen
EndIf
DrawScreen
Forever
//ASETUKSET------------------------------------------------------------
Asetukset:
Repeat
DrawScreen
Forever