From 991c2de75c4d8d78e135d38eae2dfbd09ac0573a Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 29 Nov 2005 20:35:03 +0000 Subject: Implementing new special block code --- game.bmx | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'game.bmx') diff --git a/game.bmx b/game.bmx index 606c014..94edada 100644 --- a/game.bmx +++ b/game.bmx @@ -18,6 +18,7 @@ Type TGame Field alpha:Double Field alphainc:Double Field count:Int + Field total:Int Field block:TPiece Field nextblock:TPiece Field drop:Int @@ -27,12 +28,14 @@ Type TGame gm=New TGameMap level=1 Particles.Clear() - alpha=0.7 + TextParticles.Clear() + alpha=0.0 alphainc=0.01 count=0 - nextblock=TPiece.Create() + total=0 + nextblock=TPiece.Create(False) drop=False - CreateNext() + CreateNext(False) End Method Method SetInitLevel(l:Int) @@ -53,11 +56,11 @@ Type TGame count=0 End Method - Method CreateNext() + Method CreateNext(special:Int) block=nextblock - block.y=-4 + block.y=-3 block.x=Pit.WIDTH/2 - nextblock=TPiece.Create() + nextblock=TPiece.Create(special) nextblock.x=Pit.WIDTH+3 nextblock.y=1 drop=False @@ -112,15 +115,18 @@ Type TGame Cls - GameGFX.large.DrawColoured("SCORE",0,0,255,255,0) + TextParticles.Draw() + + GameGFX.large.Draw("SCORE",0,0,255,255,0) GameGFX.large.Draw(score,0,20) - GameGFX.large.DrawColoured("LEVEL",0,100,255,255,0) + GameGFX.large.Draw("LEVEL",0,100,255,255,0) GameGFX.large.Draw(level,0,120) - - GameGFX.large.DrawColoured("NEXT",Pit.X(Pit.WIDTH+2),Pit.Y(-1),255,255,0) + nextblock.Draw() + block.Draw() + If Not gm.overflow If KeyHit(KEY_ESCAPE) playing=False @@ -137,12 +143,16 @@ Type TGame block.y:-1 block.AddToMap(gm) count:+1 + total:+1 If count>10 LevelUp() EndIf If Not gm.overflow - CreateNext() + score:+level*2 + CreateNext((total Mod 30)=0) + Else + FlushKeys() EndIf EndIf EndIf @@ -164,14 +174,22 @@ Type TGame If KeyHit(GameConfig.krotright) block.RotateRight() If block.Collides(gm) - block.RotateLeft() + block.x:-1 + If block.Collides(gm) + block.x:+1 + block.RotateLeft() + EndIf EndIf EndIf If KeyHit(GameConfig.krotleft) block.RotateLeft() If block.Collides(gm) - block.RotateRight() + block.x:+1 + If block.Collides(gm) + block.x:-1 + block.RotateRight() + EndIf EndIf EndIf @@ -181,9 +199,7 @@ Type TGame EndIf EndIf - block.Draw() - - score:+gm.Draw()*level*10 + score:+gm.Draw()*level*20 Else gm.Draw() @@ -192,7 +208,7 @@ Type TGame DrawImage(GameGFX.gameover,GraphicsWidth()/2,GraphicsHeight()/2) SetAlpha(1) alpha:+alphainc - If alpha<=0.7 Or alpha>=1.0 + If (alpha<=0.7 And alphainc<0) Or (alpha>=1.0 And alphainc>0) alpha=Max(0,Min(1,alpha)) alphainc=-alphainc EndIf @@ -208,6 +224,7 @@ Type TGame Pause() EndIf + Sound.Process() Flip Return playing -- cgit v1.2.3