Eli yritän tässä väsätä jonkinmoista hahmonluontisysteemiä kokeilu- ja harjoittelumielessä. Ongelmana on vain se, että nykyisessä muodossaan systeemi ei "tallenna" hahmo-tyypin fieldejä vaan unohtaa ne aina seuraavaan vaiheeseen siirryttäessä. Apua kaipaan ongelman ratkaisussa ja ehdotukset mahdollisesta yksinkertaisemmasta systeemistä otan mielelläni vastaan.
Code: Select all
SCREEN 640,480
FrameLimit 40
courier=LoadFont("courier new",40) 'ladataan fontit
courier1=LoadFont("courier new",16)
courier2=LoadFont("courier new",24)
Type hahmo 'määritetään tyypit
Field gender$
Field race$
Field weapons$
Field magic$
Field name$
End Type
Global moodi 'määritetään muuttujat globaaleiksi
Global hahmomoodi
Global valinta
Global hahmo
Repeat 'pääsilmukka alkaa
//HAHMONLUONTI:
PELAAJA_yleis.hahmo = New(hahmo)
moodi=10
If moodi=10 And hahmomoodi=0 Then 'SUKUPUOLI
Color 96,127,13
Box 80,60,480,360,1
Color 192,0,0
Box 79,59,482,362,0
Box 430,70,120,340,0
SetFont courier2
hl_loota(90,70,"Gender","-choose the gender of thine character-",1,0)
hl_loota1(90,110,"Race")
hl_loota1(90,150,"Abilities")
hl_loota1(90,190,"Weapons")
hl_loota1(90,230,"Magic")
hl_loota1(90,270,"Name")
ElseIf hahmomoodi=1 Then 'VALINTA
Color 96,127,13
Box 160,120,320,240,1
Color 192,0,0
Box 158,118,324,244,0
SetFont courier2
hl_loota(200,150,"Male","-continue-",2,1)
hl_loota(330,150,"Female","-continue-",2,2)
If valinta=1 Then
PELAAJA_yleis\gender$ = "Male"
ElseIf valinta=2 Then
PELAAJA_yleis\gender$ = "Female"
EndIf
ElseIf hahmomoodi=2 Then 'ROTU
Color 96,127,13
Box 80,60,480,360,1
Color cbwhite
SetFont courier1
Text 433,73,"Gender: "+ PELAAJA_yleis\gender$
Color 192,0,0
Box 79,59,482,362,0
Box 430,70,120,340,0
SetFont courier2
hl_loota1(90,70,"Gender")
hl_loota(90,110,"Race","-choose the race of thine character-",3,0)
hl_loota1(90,150,"Abilities")
hl_loota1(90,190,"Weapons")
hl_loota1(90,230,"Magic")
hl_loota1(90,270,"Name")
ElseIf hahmomoodi=3 Then 'VALINTA
Color 96,127,13
Box 160,120,320,240,1
Color 192,0,0
Box 158,118,324,244,0
SetFont courier2
hl_loota(200,150,"Human","-continue-",4,3)
hl_loota(330,150,"Elf","-continue-",4,4)
hl_loota(200,190,"Dwarf","-continue-",4,5)
hl_loota(330,190,"Halfling","-continue-",4,6)
hl_loota(265,230,"Half-Orc","-continue-",4,7)
If valinta=3 Then
PELAAJA_yleis\race$="Human"
ElseIf valinta=4 Then
PELAAJA_yleis\race$="Elf"
ElseIf valinta=5 Then
PELAAJA_yleis\race$="Dwarf"
ElseIf valinta=6 Then
PELAAJA_yleis\race$="Halfling"
ElseIf valinta=7 Then
PELAAJA_yleis\race$="Half-Orc"
EndIf
ElseIf hahmomoodi=4 Then 'OMINAISUUDET
Color 96,127,13
Box 80,60,480,360,1
Color cbwhite
SetFont courier1
Text 433,73,"Gender: "+ PELAAJA_yleis\gender$ +" "
Text 433,88,"Race: "+ PELAAJA_yleis\race$ +" "
Color 192,0,0
Box 79,59,482,362,0
Box 430,70,120,340,0
SetFont courier2
hl_loota1(90,70,"Gender")
hl_loota1(90,110,"Race")
hl_loota(90,150,"Abilities","-choose the abilities of thine character-",5,0)
hl_loota1(90,190,"Weapons")
hl_loota1(90,230,"Magic")
hl_loota1(90,270,"Name")
EndIf
DrawScreen 'piirretään kaikki
Forever 'pyöritetään ikuisesti
'---------------------
//hahmonluontilootafunktio AUKI
Function hl_loota(x,y,txt$,info$,z,a)
Color cbred
Box x,y,120,35,0
Color cbwhite
CenterText x+60,y+6,txt$
Color cbyellow
If MouseX()>=x And MouseX()<=x+120 And MouseY()>=y And MouseY()<=y+35 Then
Box x+2,y+2,114,31,0
CenterText 320,440,info$
If MouseHit(1) Then
valinta=a
hahmomoodi=z
EndIf
EndIf
End Function
//hahmonluontilootafunktio VARATTU
Function hl_loota1(x,y,txt$)
Color cbsilver
Box x,y,120,35,1
Color cbdark
CenterText x+60,y+6,txt$
Color cbred
If MouseX()>=x And MouseX()<=x+120 And MouseY()>=y And MouseY()<=y+35 Then
Box x+2,y+2,114,31,0
EndIf
End Function