From 2a0e7de95036f380a5729328c10ba86eb6e001ba Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 1 Nov 2005 00:58:44 +0000 Subject: Initial reasonably working version --- hiscore.bmx | 92 +++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 30 deletions(-) (limited to 'hiscore.bmx') 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 scGameConfig.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 -- cgit v1.2.3