diff options
| author | Ian C <ianc@noddybox.co.uk> | 2005-09-27 00:48:54 +0000 |
|---|---|---|
| committer | Ian C <ianc@noddybox.co.uk> | 2005-09-27 00:48:54 +0000 |
| commit | 497670ace3bfaf6b28931ac12c4a0a8ee553bf55 (patch) | |
| tree | 79ee3a0f2c86f2c9e77523514da8789ac47a92e3 /level.bmx | |
| parent | f52fff7f3f56fbf79fd05017c0ae0f0836d3d6e2 (diff) | |
Designer pretty much complete. Some bug fixes to the game engine.
Diffstat (limited to 'level.bmx')
| -rw-r--r-- | level.bmx | 80 |
1 files changed, 60 insertions, 20 deletions
@@ -10,7 +10,7 @@ Import noddybox.bitmapfont Import noddybox.algorithm Import "types.bmx" -Const MAGIC:String="PPINCH0.0" +Const MAGIC:String="PPINCH_0001" Const MAX_GRAV:Int=10 Const MAX_POINT:Int=1000 @@ -47,6 +47,7 @@ Type TGravPoint m.x=x m.y=y m.inverse=repel + Return m End Method Function FromStream:TGravPoint(s:TStream) @@ -75,27 +76,50 @@ Type TPointLine Field y2:Float Field gap:Int Field v:TVector + Field circle:Int + Field circvel:Float Method New() v=TVector.Create() + gap=1 + circle=False + circvel=1 End Method Method CreatePoints(l:TList) - Local line:TList=DoLine(x1,y1,x2,y2) - Local n:Int=line.Count() - Local i:Int=0 - - For Local p:TAlgoPoint=EachIn line - If (i Mod gap)=0 - Local tp:TPoint=New TPoint - tp.x=p.x - tp.y=p.y - tp.v.x=v.x - tp.v.y=v.y - l.AddLast(tp) - EndIf - i:+1 - Next + If circle + Local p:TAlgoPoint[]=DoCircle(x1,y1,Abs(x2-x1)) + Local i:Int=0 + + For Local f:Int=0 To 359 + If (i Mod gap)=0 + Local tp:TPoint=New TPoint + tp.x=p[f].x + tp.y=p[f].y + tp.v.x=Sin(f+90)*circvel + tp.v.y=Cos(f+90)*circvel + tp.v.Add(v) + l.AddLast(tp) + EndIf + i:+1 + Next + Else + Local line:TList=DoLine(x1,y1,x2,y2) + Local n:Int=line.Count() + Local i:Int=0 + + For Local p:TAlgoPoint=EachIn line + If (i Mod gap)=0 + Local tp:TPoint=New TPoint + tp.x=p.x + tp.y=p.y + tp.v.x=v.x + tp.v.y=v.y + l.AddLast(tp) + EndIf + i:+1 + Next + EndIf End Method Function FromStream:TPointLine(s:TStream) @@ -105,8 +129,10 @@ Type TPointLine o.x2=s.ReadFloat() o.y2=s.ReadFloat() o.gap=s.ReadInt() - o.v.x=s.ReadInt() - o.v.y=s.ReadInt() + o.v.x=s.ReadFloat() + o.v.y=s.ReadFloat() + o.circle=s.ReadInt() + o.circvel=s.ReadFloat() Return o End Function @@ -116,8 +142,10 @@ Type TPointLine s.WriteFloat(x2) s.WriteFloat(y2) s.WriteInt(gap) - s.WriteInt(v.x) - s.WriteInt(v.y) + s.WriteFloat(v.x) + s.WriteFloat(v.y) + s.WriteInt(circle) + s.WriteFloat(circvel) End Method End Type @@ -129,6 +157,8 @@ Type TLevel Field winpercent:Int Field timer:Int Field invmass:Int + Field placemass:Float + Field placefriend:Int Method New() grav=CreateList() @@ -138,6 +168,8 @@ Type TLevel winpercent=50 timer=60 invmass=False + placemass=25 + placefriend=True End Method Method CreatePlayfield(masslist:TList, pointlist:TList) @@ -158,6 +190,8 @@ Type TLevel o.winpercent=s.ReadInt() o.timer=s.ReadInt() o.invmass=s.ReadInt() + o.placemass=s.ReadFloat() + o.placefriend=s.ReadInt() c=s.ReadInt() For Local f:Int=1 To c @@ -178,6 +212,9 @@ Type TLevel s.WriteInt(winpercent) s.WriteInt(timer) s.WriteInt(invmass) + s.WriteFloat(placemass) + s.WriteInt(placefriend) + s.WriteInt(grav.Count()) For Local o:TGravPoint=EachIn grav o.ToStream(s) @@ -193,6 +230,7 @@ End Type Type TLevelSet Field name:String Field level:TList + Field stamp:String Method New() level=CreateList() @@ -216,6 +254,7 @@ Type TLevelSet TLevelException.Error(file + " doesn't appear to be a valid file for this version") EndIf + o.stamp=s.ReadLine() o.name=s.ReadLine() c=s.ReadInt() @@ -236,6 +275,7 @@ Type TLevelSet EndIf s.WriteLine(MAGIC) + s.WriteLine(CurrentDate()+CurrentTime()) s.WriteLine(name) s.WriteInt(level.Count()) For Local o:TLevel=EachIn level |
