summaryrefslogtreecommitdiff
path: root/hiscore.bmx
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-11-01 00:58:44 +0000
committerIan C <ianc@noddybox.co.uk>2005-11-01 00:58:44 +0000
commit2a0e7de95036f380a5729328c10ba86eb6e001ba (patch)
tree2d0bea43efd8ecaa16f69a0e9099b7b5c21d813e /hiscore.bmx
parentefbbdf1ebbc3f6964369c08d4cbe0978c5a424dd (diff)
Initial reasonably working version
Diffstat (limited to 'hiscore.bmx')
-rw-r--r--hiscore.bmx92
1 files changed, 62 insertions, 30 deletions
diff --git a/hiscore.bmx b/hiscore.bmx
index 96c6935..5c4311b 100644
--- a/hiscore.bmx
+++ b/hiscore.bmx
@@ -37,7 +37,7 @@ Type THiscore
For Local f:Int=0 Until NUM
Local sc:Int=s.ReadInt()
- Local n:String=s.ReadString(3)
+ Local n:String=s.ReadLine()
o.score[f]=THiscoreEnt.Create(n,sc)
Next
@@ -48,8 +48,6 @@ Type THiscore
End Function
Method Save()
- Return
-
Local s:TStream=WriteStream("vectoroids.hiscore")
If s=Null
@@ -60,7 +58,7 @@ Type THiscore
For Local sc:THiscoreEnt=EachIn score
s.WriteInt(sc.score)
- s.WriteString(sc.name)
+ s.WriteLine(sc.name)
Next
s.Close()
@@ -83,59 +81,93 @@ Type THiscore
Next
End Method
- Method CheckScore(sc:Int)
+ Method Check(sc:Int)
If sc<score[NUM-1].score
Return
EndIf
Local done:Int=False
Local a:String="abcdefghijklmnopqrstuvwxyz{}"
- Local curs:Int=0
+ Local cur:Int=0
Local nm:String=""
Local last:Int=0
Local del:Int=0
+ Local tx:Int=GraphicsWidth()/2-GameGFX.font.TextWidth("___")
+ Local press:Int=False
While Not done
Cls
+ GameGFX.font.Centre("enter your name for",0)
+ GameGFX.font.Centre("the hall of fame",20)
+
+ SetScale(2,2)
+ GameGFX.font.Draw("___",tx,300)
+ GameGFX.font.Draw(nm+a[cur..cur+1],tx,300)
+ SetScale(1,1)
+
If del
del:-1
EndIf
- If KeyHit(GameConfig.kleft) And (last<>GameConfig.kleft Or del=0)
- del=40
- last=GameConfig.kleft
- cur:-1
- If cur<0
- cur:+Len(a)
+ If KeyDown(GameConfig.kleft)
+ If last<>GameConfig.kleft Or del=0
+ If last=GameConfig.kleft
+ del=5
+ Else
+ del=20
+ EndIf
+ last=GameConfig.kleft
+ cur:-1
+ If cur<0
+ cur:+a.length
+ EndIf
EndIf
- EndIf
-
- If KeyHit(GameConfig.kright) And (last<>GameConfig.kright Or del=0)
- del=40
- last=GameConfig.kright
- cur:+1
- If cur=Len(a)
- cur=0
+ press=True
+ ElseIf KeyDown(GameConfig.kright)
+ If last<>GameConfig.kright Or del=0
+ If last=GameConfig.kright
+ del=5
+ Else
+ del=20
+ EndIf
+ last=GameConfig.kright
+ cur:+1
+ If cur=a.length
+ cur=0
+ EndIf
EndIf
+ press=True
+ Else
+ press=False
+ last=0
+ del=0
EndIf
- If KeyDown(GameConfig.khyper) And (last<>GameConfig.kright Or del=0)
- del=40
- last=GameConfig.kright
- cur:+1
- If cur=Len(a)
- cur=0
+ If KeyHit(GameConfig.khyper)
+ Local c:String=a[cur..cur+1]
+
+ If c="{"
+ If nm.length>1
+ nm=nm[0..nm.length-1]
+ ElseIf nm.length=1
+ nm=""
+ EndIf
+ Else If c="}"
+ done=True
+ Else
+ nm:+c
+ If nm.length=3
+ done=True
+ EndIf
EndIf
EndIf
- GameGFX.font.Centre("enter your name for",0)
- GameGFX.font.Centre("the hall of fame",20)
-
Flip
FlushMem
Wend
+ score[NUM-1]=THiscoreEnt.Create(nm.ToUpper(),sc)
score.Sort()
Save()
End Method
@@ -156,7 +188,7 @@ Type THiscoreEnt
Local os:THiscoreEnt=THiscoreEnt(o)
If os
- Return score-os.score
+ Return os.score-score
Else
Return 0
EndIf