133 lines
No EOL
3.5 KiB
Text
133 lines
No EOL
3.5 KiB
Text
Global mainmargin, btthit, hiiri, font, bigfont, hlpvihu, poistuttu, bgrr, bgrg, bgrb, lvl1spd
|
|
poistuttu = False
|
|
|
|
//Taustavärin asetus
|
|
bgrr = 200
|
|
bgrg = 0
|
|
bgrb = 0
|
|
|
|
// Tasojen nopeudet
|
|
lvl1spd = 3
|
|
|
|
//Lopun lähdekoodin hakeminen
|
|
Include "nappi.cb"
|
|
Include "help.cb"
|
|
Include "highscore.cb"
|
|
Include "credits.cb"
|
|
Include "game.cb"
|
|
|
|
SCREEN 640, 480, 0, 2
|
|
ChDir "files"
|
|
Color 10, 10, 10
|
|
ClsColor bgrr, bgrg, bgrb
|
|
|
|
mainmargin = 10
|
|
|
|
loadbasicres()
|
|
|
|
Function loadbasicres()
|
|
SetWindow "Hyvä lehmä VS Paha lehmä", 3
|
|
|
|
//Ladataan resurssit
|
|
hiiri = LoadImage("cursor.bmp")
|
|
btthit = LoadSound("buttonhit.wav")
|
|
bgm = PlaySound("BGM01.Mid", 20)
|
|
bgm = PlaySound("BGM01.Mid", 20)
|
|
font = LoadFont("Comic sans ms", 18)
|
|
bigfont = LoadFont("Comic sans ms", 30, 1)
|
|
hlpvihu = LoadAnimobject("vihu.bmp", 32, 32, 0, 11)
|
|
LoopObject hlpvihu, 0, 10, 0.1, OFF
|
|
ScreenPositionObject hlpvihu, ScreenWidth() - 32 - mainmargin, 32 + mainmargin
|
|
ShowObject hlpvihu, OFF
|
|
SetFont font
|
|
ShowMouse hiiri
|
|
|
|
//Poistetaan turhat napit
|
|
Nappi_Poista()
|
|
//Alustetaan nappien lukumäärä
|
|
i = 0
|
|
//Lisätään päävalikon napit
|
|
Nappi_Lisaa(mainmargin, mainmargin + 15 * 0 + 28 * i, ScreenWidth()-2*mainmargin, 20, "Uusi Peli"):i = i + 1
|
|
Nappi_Lisaa(mainmargin, mainmargin + 15 * 1 + 28 * i, ScreenWidth()-2*mainmargin, 20, "Viimeisimmät tulokset"):i = i + 1
|
|
Nappi_Lisaa(mainmargin, mainmargin + 15 * 2 + 28 * i, ScreenWidth()-2*mainmargin, 20, "Pikaopas"):i = i + 1
|
|
Nappi_Lisaa(mainmargin, mainmargin + 15 * 2 + 28 * i, ScreenWidth()-2*mainmargin, 20, "Tietoja"):i = i + 1
|
|
Nappi_Lisaa(mainmargin, mainmargin + 15 * 3 + 28 * i, ScreenWidth()-2*mainmargin, 20, "Työpöydän taustakuva"):i = i + 1
|
|
Nappi_Lisaa(mainmargin, mainmargin + 15 * 4 + 28 * i, ScreenWidth()-2*mainmargin, 20, "Lopeta Peli"):i = i + 1
|
|
Nappi_Lisaa(mainmargin, mainmargin + 15 * 5 + 28 * i, ScreenWidth()-2*mainmargin, 20, "Lvl 2"):i = i + 1
|
|
EndFunction
|
|
|
|
Repeat
|
|
Nappi_Piirra()
|
|
DrawScreen
|
|
|
|
If KeyHit(cbkeyreturn) Then
|
|
PlaySound btthit
|
|
If help() Then
|
|
lataus()
|
|
game(1, 0, lvl1spd)
|
|
palauta()
|
|
EndIf
|
|
EndIf
|
|
|
|
Select Nappi_Paivita()
|
|
Case "Uusi Peli"
|
|
PlaySound btthit
|
|
If help() Then
|
|
lataus()
|
|
game(1, 0, lvl1spd)
|
|
palauta()
|
|
EndIf
|
|
Case "Pikaopas"
|
|
PlaySound btthit
|
|
If help() Then
|
|
poistuttu = True
|
|
game(1, 0, lvl1spd)
|
|
palauta()
|
|
EndIf
|
|
Case "Viimeisimmät tulokset"
|
|
PlaySound btthit
|
|
highscore()
|
|
Case "Tietoja"
|
|
PlaySound btthit
|
|
credits()
|
|
Case "Työpöydän taustakuva"
|
|
PlaySound btthit
|
|
Execute "logo.jpg"
|
|
Case "Lopeta Peli"
|
|
sound = PlaySound(btthit)
|
|
While SoundPlaying(sound) : Wend
|
|
End
|
|
Case "Lvl 2"
|
|
PlaySound btthit
|
|
lataus()
|
|
game(2, 0, lvl1spd)
|
|
palauta()
|
|
EndSelect
|
|
|
|
//Palautetaan päävalikko muuallakäynnin jälkeen
|
|
If poistuttu Then
|
|
|
|
EndIf
|
|
Forever
|
|
|
|
Function lataus()
|
|
SetFont bigfont
|
|
CenterText ScreenWidth() / 2, ScreenHeight() / 2, "Ladataan...", 2
|
|
DrawScreen
|
|
SetFont font
|
|
EndFunction
|
|
|
|
Function palauta()
|
|
ClearText
|
|
Locate ScreenWidth() / 2 - TextWidth("Pisteesi: " + Str(pisteet)) / 2, ScreenHeight() - TextHeight("Pisteesi: " + Str(pisteet))
|
|
AddText "Pisteesi: " + Str(pisteet)
|
|
loadbasicres()
|
|
EndFunction
|
|
|
|
Function ObjectToMap(objekti, kartta, x, y)
|
|
mapX = ObjectSizeX(kartta)
|
|
mapY = ObjectSizeY(kartta)
|
|
tileX = mapX / MapWidth()
|
|
tileY = mapY / MapHeight()
|
|
PositionObject objekti, (ObjectX(kartta)-mapX/2)+tileX*(X-1)+tileX/2, (ObjectY(kartta)+mapY/2)-tileY*(Y-1)-tileY/2
|
|
EndFunction |