diff --git a/applications/tappytux/gameplayform.lfm b/applications/tappytux/gameplayform.lfm index 74a022350..49004983e 100644 --- a/applications/tappytux/gameplayform.lfm +++ b/applications/tappytux/gameplayform.lfm @@ -186,51 +186,6 @@ object formTappyTuxGame: TformTappyTuxGame TabOrder = 5 Visible = False end - object Question1: TEdit - Left = 112 - Height = 23 - Top = 24 - Width = 82 - ReadOnly = True - TabOrder = 6 - Text = 'Question' - end - object Question2: TEdit - Left = 216 - Height = 23 - Top = 24 - Width = 80 - ReadOnly = True - TabOrder = 7 - Text = 'Question' - end - object Question4: TEdit - Left = 320 - Height = 23 - Top = 24 - Width = 80 - ReadOnly = True - TabOrder = 8 - Text = 'Question' - end - object Question3: TEdit - Left = 424 - Height = 23 - Top = 24 - Width = 80 - ReadOnly = True - TabOrder = 9 - Text = 'Question' - end - object Question5: TEdit - Left = 528 - Height = 23 - Top = 24 - Width = 80 - ReadOnly = True - TabOrder = 10 - Text = 'Question' - end object GameOver: TToggleBox Left = 240 Height = 64 @@ -241,7 +196,7 @@ object formTappyTuxGame: TformTappyTuxGame Color = clRed Enabled = False State = cbChecked - TabOrder = 11 + TabOrder = 6 Visible = False end object Yes: TButton @@ -252,7 +207,7 @@ object formTappyTuxGame: TformTappyTuxGame Caption = 'Yes' Color = clRed OnClick = YesClick - TabOrder = 12 + TabOrder = 7 Visible = False end object No: TButton @@ -263,7 +218,7 @@ object formTappyTuxGame: TformTappyTuxGame Caption = 'No' Color = clRed OnClick = NoClick - TabOrder = 13 + TabOrder = 8 Visible = False end end diff --git a/applications/tappytux/gameplayform.pas b/applications/tappytux/gameplayform.pas index e7f5734be..2deb5ffd4 100644 --- a/applications/tappytux/gameplayform.pas +++ b/applications/tappytux/gameplayform.pas @@ -20,11 +20,6 @@ type Answer: TEdit; No: TButton; Yes: TButton; - Question1: TEdit; - Question2: TEdit; - Question4: TEdit; - Question3: TEdit; - Question5: TEdit; Level: TEdit; Score: TEdit; Lives: TEdit; @@ -50,7 +45,6 @@ type var formTappyTuxGame: TformTappyTuxGame; - Questions : array[1..5] of TEdit; implementation @@ -94,11 +88,6 @@ end; procedure TformTappyTuxGame.FormShow(Sender: TObject); begin - Questions[1] := Question1; - Questions[2] := Question2; - Questions[3] := Question3; - Questions[4] := Question4; - Questions[5] := Question5; end; @@ -119,10 +108,6 @@ procedure TformTappyTuxGame.YesClick(Sender: TObject); var i: Integer; begin - for i:= 1 to 5 do - begin - Questions[i].Top := 24; - end; GetCurrentModule().StartNewGame(formConfig.comboSound.ItemIndex, formConfig.comboMusic.ItemIndex, formConfig.comboLevel.ItemIndex, diff --git a/applications/tappytux/mod_tappymath.pas b/applications/tappytux/mod_tappymath.pas index e363a2b49..f66060a71 100644 --- a/applications/tappytux/mod_tappymath.pas +++ b/applications/tappytux/mod_tappymath.pas @@ -5,7 +5,7 @@ unit mod_tappymath; interface uses - Classes, SysUtils, + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, // LCL ExtCtrls, // TappyTux @@ -24,8 +24,10 @@ type gameSLevel : Integer; gameSndFX : Boolean; gameMusic : Boolean; + gameQuestionList : TStringList; questionType : array[1..3] of Integer; questionAnswer : array[1..5] of Integer; + count : Integer; timerMath : TTimer; procedure HandleOnTimer(Sender: TObject); @@ -38,7 +40,6 @@ type procedure CreateQuestion(); override; procedure Answered(); override; procedure EndGame(); override; - procedure QuestionGenerator(qNumber : Integer); end; implementation @@ -50,19 +51,38 @@ uses gameplayform; procedure TTappyMath.HandleOnTimer(Sender: TObject); var i: Integer; + j: Integer; + frequency: Integer; begin - for i:= 1 to 5 do + i:= 0; + j:= vTappyTuxDrawer.GetAnimationCount - 1; + while (i<= j) do begin - Questions[i].Top := Questions[i].Top + (5*gameLevel); - if ((Questions[i].Top >= 370)) then + if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then begin - gameLives := gameLives - 1; - formTappyTuxGame.Lives.Text := IntToStr(gameLives); - if (gameLives = 0) then EndGame(); - Questions[i].Top:= 24; - QuestionGenerator(i); + if (vTappyTuxDrawer.GetAnimation(i).Position.y >= 270) then + begin + gameLives := gameLives - 1; + formTappyTuxGame.Lives.Text := IntToStr(gameLives); + vTappyTuxDrawer.RemoveAnimation(i); + i := i - 1; + if (gameLives = 0) then EndGame(); + CreateQuestion; + end; end; - end + i := i + 1; + j := vTappyTuxDrawer.GetAnimationCount - 1; + end; + + frequency := 30; + count := count + 1; + if count >= frequency then + begin + count := 0; + CreateQuestion(); + end; + + vTappyTuxDrawer.HandleAnimationOnTimer(); end; @@ -99,8 +119,9 @@ end; procedure TTappyMath.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer); var i: Integer; + lTuxAnimation: TTappySpriteAnimation; begin - + count := 0; timerMath.Enabled := True; gameScore := 0; gameLives := 5; @@ -120,74 +141,195 @@ begin formTappyTuxGame.Score.Text := IntToStr(gameScore); formTappyTuxGame.Lives.Text := IntToStr(gameLives); + // Animations Creation + lTuxAnimation := TTappySpriteAnimation.Create; + lTuxAnimation.IsInfinite := True; + lTuxAnimation.StartPoint := Point(250, 328); + lTuxAnimation.EndPoint := lTuxAnimation.StartPoint; + SetLength(lTuxAnimation.Bitmaps, 6); + lTuxAnimation.Bitmaps[0] := TPortableNetworkGraphic.Create; + lTuxAnimation.Bitmaps[0].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_1.png'); + lTuxAnimation.Bitmaps[1] := TPortableNetworkGraphic.Create; + lTuxAnimation.Bitmaps[1].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_2.png'); + lTuxAnimation.Bitmaps[2] := TPortableNetworkGraphic.Create; + lTuxAnimation.Bitmaps[2].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_3.png'); + lTuxAnimation.Bitmaps[3] := TPortableNetworkGraphic.Create; + lTuxAnimation.Bitmaps[3].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_4.png'); + lTuxAnimation.Bitmaps[4] := lTuxAnimation.Bitmaps[2]; + lTuxAnimation.Bitmaps[5] := lTuxAnimation.Bitmaps[1]; + vTappyTuxDrawer.AddAnimation(lTuxAnimation); + for i:= 1 to 5 do begin - QuestionGenerator(i); + CreateQuestion; end end; procedure TTappyMath.CreateQuestion; -begin - -end; - -procedure TTappyMath.Answered; var i: Integer; + j: Integer; + xAux: Integer; + yAux: Integer; + heightAux: array [0..4] of integer; + existenceAux: array [0..4] of boolean; + snowmanAnimation: TFallingText; + begin - for i:= 1 to 5 do + + for i:= 0 to 4 do begin - if (formTappyTuxGame.Answer.Text = IntToStr(questionAnswer[i])) then + existenceAux[i]:= False; + heightAux[i] := 500; + end; + + xAux:=5; + yAux:=5; + + snowmanAnimation := TFallingText.Create; + snowmanAnimation.IsInfinite := False; + + + for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do + begin + if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then + begin + for j:= 0 to 4 do + begin + if vTappyTuxDrawer.GetAnimation(i).StartPoint.X = 5+(103*j) then + begin + existenceAux[j] := True; + if vTappyTuxDrawer.GetAnimation(i).Position.Y < heightAux[j] then heightAux[j] := vTappyTuxDrawer.GetAnimation(i).Position.Y; + end; + end; + end; + end; + + for i:= 0 to 4 do + begin + if heightAux[i] > yAux then + begin + yAux := heightAux[i]; + xAux := 5 + i*103; + end; + end; + + + if existenceAux[0] = false then xAux := 5 + else + begin + if existenceAux[1] = false then xAux := 108 + else begin - Questions[i].Top := 24; - QuestionGenerator(i); - gameScore := gameScore +1; - gameLevel := (gameScore div 20) + gameSLevel; - formTappyTuxGame.Score.Text := IntToStr(gameScore); - formTappyTuxGame.Level.Text := IntToStr(gameLevel); + if existenceAux[2] = false then xAux := 211 + else + begin + if existenceAux[3] = false then xAux := 314 + else + begin + if existenceAux[4] = false then xAux := 417 + end; + end; end; - end + end; -end; + snowmanAnimation.StartPoint := Point(xAux, 5); + snowmanAnimation.EndPoint := Point(xAux, 205); + snowmanAnimation.IsInfinite:= false; + snowmanAnimation.Bitmap := TPortableNetworkGraphic.Create; + //snowmanAnimation.caption:= gameQuestionList[random(gameQuestionList.Count - 1)]; + snowmanAnimation.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowman.png'); -procedure TTappyMath.EndGame; -begin - timerMath.Enabled := False; - formTappyTuxGame.Answer.ReadOnly := true; - formTappyTuxGame.GameOver.Visible := true; - formTappyTuxGame.Yes.Visible := true; - formTappyTuxGame.No.Visible := true; -end; - -procedure TTappyMath.QuestionGenerator(qNumber : Integer); -begin questionType[1] := random(3); Case questionType[1] of 0: begin questionType[2] := random(21); questionType[3] := random(21); - questionAnswer[qNumber] := questionType[2] + questionType[3]; - Questions[qNumber].Text := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]); + snowmanAnimation.value := IntToStr(questionType[2] + questionType[3]); + snowmanAnimation.caption := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]); end; 1: begin questionType[2] := random(21); questionType[3] := random(questionType[2]); - questionAnswer[qNumber] := questionType[2] - questionType[3]; - Questions[qNumber].Text := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]); + snowmanAnimation.value := IntToStr(questionType[2] - questionType[3]); + snowmanAnimation.caption := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]); end; 2: begin questionType[2] := random(11); questionType[3] := random(11); - questionAnswer[qNumber] := questionType[2] * questionType[3]; - Questions[qNumber].Text := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]); + snowmanAnimation.value := IntToStr(questionType[2] * questionType[3]); + snowmanAnimation.caption := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]); end; end; + vTappyTuxDrawer.AddAnimation(snowmanAnimation); + +end; + +procedure TTappyMath.Answered; +var + i: Integer; + j: Integer; +begin + i:= 0; + j:= vTappyTuxDrawer.GetAnimationCount - 1; + while (i<= j) do + begin + if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then + begin + if (vTappyTuxDrawer.GetAnimation(i).value = formTappyTuxGame.Answer.Text) then + begin + gameScore := gameScore +1; + gameLevel := (gameScore div 20) + gameSLevel; + formTappyTuxGame.Score.Text := IntToStr(gameScore); + formTappyTuxGame.Level.Text := IntToStr(gameLevel); + vTappyTuxDrawer.RemoveAnimation(i); + i := i - 1; + CreateQuestion; + end; + end; + i := i + 1; + j := vTappyTuxDrawer.GetAnimationCount - 1; + end; + +end; + +procedure TTappyMath.EndGame; +var + i : Integer; + j : Integer; + gameOverScreen: TTappySpriteAnimation; + continueBtn: TButton; + exitBtn: TButton; +begin + timerMath.Enabled := False; + formTappyTuxGame.Answer.ReadOnly := true; + + //gameOverScreen := TTappySpriteAnimation.Create; + //gameOverScreen.IsInfinite := True; + //gameOverScreen.StartPoint := Point(90, 150); + //gameOverScreen.EndPoint := gameOverScreen.StartPoint; + //SetLength(gameOverScreen.Bitmaps, 1); + //gameOverScreen.Bitmaps[0] := TPortableNetworkGraphic.Create; + //gameOverScreen.Bitmaps[0].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'gameover.png'); + //vTappyTuxDrawer.AddAnimation(gameOverScreen); + + i:= 0; + j:= vTappyTuxDrawer.GetAnimationCount - 1; + while (i<= j) do + begin + vTappyTuxDrawer.RemoveAnimation(i); + j := vTappyTuxDrawer.GetAnimationCount - 1; + end; + + formTappyTuxGame.GameOver.Visible := true; + formTappyTuxGame.Yes.Visible := true; + formTappyTuxGame.No.Visible := true; end; initialization diff --git a/applications/tappytux/mod_tappywords.pas b/applications/tappytux/mod_tappywords.pas index 0d712d139..55f59d330 100644 --- a/applications/tappytux/mod_tappywords.pas +++ b/applications/tappytux/mod_tappywords.pas @@ -25,6 +25,7 @@ type gameSndFX : Boolean; gameMusic : Boolean; gameQuestionList : TStringList; + count : Integer; timerWords: TTimer; procedure HandleOnTimer(Sender: TObject); public @@ -47,41 +48,39 @@ uses gameplayform; procedure TTappyWords.HandleOnTimer(Sender: TObject); var i: Integer; + j: Integer; + frequency: Integer; begin - {for i:= 1 to vTappyTuxDrawer.GetAnimationCount do - begin - if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then - begin - vTappyTuxDrawer.GetAnimation(i).; - end; - - end;} - - for i:= 1 to 5 do - begin - Questions[i].Top := Questions[i].Top + (5*gameLevel); - if ((Questions[i].Top >= 370)) then - begin - gameLives := gameLives - 1; - formTappyTuxGame.Lives.Text := IntToStr(gameLives); - if (gameLives = 0) then EndGame(); - Questions[i].Top:= 24; - Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; - end; - end; - - for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do + i:= 0; + j:= vTappyTuxDrawer.GetAnimationCount - 1; + while (i<= j) do begin if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then begin - vTappyTuxDrawer.GetAnimation(i).StartPoint.y:= vTappyTuxDrawer.GetAnimation(i).StartPoint.y + (5*gameLevel); - vTappyTuxDrawer.GetAnimation(i).EndPoint.y:= vTappyTuxDrawer.GetAnimation(i).StartPoint.y; + if (vTappyTuxDrawer.GetAnimation(i).Position.y >= 270) then + begin + gameLives := gameLives - 1; + formTappyTuxGame.Lives.Text := IntToStr(gameLives); + vTappyTuxDrawer.RemoveAnimation(i); + i := i - 1; + if (gameLives = 0) then EndGame(); + CreateQuestion; + end; end; + i := i + 1; + j := vTappyTuxDrawer.GetAnimationCount - 1; end; - + frequency := 30; + count := count + 1; + if count >= frequency then + begin + count := 0; + CreateQuestion(); + end; vTappyTuxDrawer.HandleAnimationOnTimer(); + end; constructor TTappyWords.Create; @@ -119,6 +118,7 @@ var lTuxAnimation: TTappySpriteAnimation; begin + count := 5; timerWords.Enabled := True; gameScore := 0; gameLives := 5; @@ -132,8 +132,8 @@ begin if QuestionList < 0 then QuestionList := 0; gameQuestionList := TStringList.Create; - gameQuestionList.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images'+PathDelim+'modules'+PathDelim+'tappywords'+PathDelim+'0.txt'); - //gameQuestionList.LoadFromFile('C:/'+IntToStr(QuestionList)+'.txt'); + //gameQuestionList.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images'+PathDelim+'modules'+PathDelim+'tappywords'+PathDelim+'0.txt'); + gameQuestionList.LoadFromFile('C:/'+IntToStr(QuestionList)+'.txt'); formTappyTuxGame.Answer.ReadOnly := false; formTappyTuxGame.GameOver.Visible := false; @@ -143,12 +143,6 @@ begin formTappyTuxGame.Score.Text := IntToStr(gameScore); formTappyTuxGame.Lives.Text := IntToStr(gameLives); - for i:= 1 to 5 do - begin - //Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; - Questions[i].Text := gameQuestionList[random(gameQuestionList.Count - 1)]; - end; - // Animations Creation lTuxAnimation := TTappySpriteAnimation.Create; lTuxAnimation.IsInfinite := True; @@ -167,9 +161,10 @@ begin lTuxAnimation.Bitmaps[5] := lTuxAnimation.Bitmaps[1]; vTappyTuxDrawer.AddAnimation(lTuxAnimation); + for i:= 1 to 5 do begin - CreateQuestion(); + CreateQuestion; end; end; @@ -177,64 +172,76 @@ end; procedure TTappyWords.CreateQuestion(); var i: Integer; + j: Integer; xAux: Integer; yAux: Integer; + heightAux: array [0..4] of integer; + existenceAux: array [0..4] of boolean; snowmanAnimation: TFallingText; - existenceAux1, existenceAux2, existenceAux3, existenceAux4, existenceAux5: boolean; begin - existenceAux1:= false; - existenceAux2:= false; - existenceAux3:= false; - existenceAux4:= false; - existenceAux5:= false; + + for i:= 0 to 4 do + begin + existenceAux[i]:= False; + heightAux[i] := 500; + end; + xAux:=5; yAux:=5; - snowmanAnimation := TFallingText.Create; - snowmanAnimation.IsInfinite := True; - if True then + snowmanAnimation := TFallingText.Create; + snowmanAnimation.IsInfinite := False; + + + for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do begin - for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do + if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then begin - if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then - begin - if vTappyTuxDrawer.GetAnimation(i).StartPoint.x = 5 then existenceAux1 := True; - if vTappyTuxDrawer.GetAnimation(i).StartPoint.x = 108 then existenceAux2 := True; - if vTappyTuxDrawer.GetAnimation(i).StartPoint.x = 211 then existenceAux3 := True; - if vTappyTuxDrawer.GetAnimation(i).StartPoint.x = 314 then existenceAux4 := True; - if vTappyTuxDrawer.GetAnimation(i).StartPoint.x = 427 then existenceAux5 := True; - if vTappyTuxDrawer.GetAnimation(i).StartPoint.y > yAux then - begin - xAux := vTappyTuxDrawer.GetAnimation(i).StartPoint.x; - yAux := vTappyTuxDrawer.GetAnimation(i).StartPoint.y; - end; - end; + for j:= 0 to 4 do + begin + if vTappyTuxDrawer.GetAnimation(i).StartPoint.X = 5+(103*j) then + begin + existenceAux[j] := True; + if vTappyTuxDrawer.GetAnimation(i).Position.Y < heightAux[j] then heightAux[j] := vTappyTuxDrawer.GetAnimation(i).Position.Y; + end; + end; end; end; - if existenceAux1 = false then xAux := 5 + for i:= 0 to 4 do + begin + if heightAux[i] > yAux then + begin + yAux := heightAux[i]; + xAux := 5 + i*103; + end; + end; + + + if existenceAux[0] = false then xAux := 5 else begin - if existenceAux2 = false then xAux := 108 + if existenceAux[1] = false then xAux := 108 else begin - if existenceAux3 = false then xAux := 211 + if existenceAux[2] = false then xAux := 211 else begin - if existenceAux4 = false then xAux := 314 + if existenceAux[3] = false then xAux := 314 else begin - if existenceAux5 = false then xAux := 427 + if existenceAux[4] = false then xAux := 417 end; end; end; end; snowmanAnimation.StartPoint := Point(xAux, 5); - snowmanAnimation.EndPoint := snowmanAnimation.StartPoint; + snowmanAnimation.EndPoint := Point(xAux, 205); + snowmanAnimation.IsInfinite:= false; snowmanAnimation.Bitmap := TPortableNetworkGraphic.Create; - snowmanAnimation.QuestionText:= formTappyTuxGame.Test.Lines.Strings[random(71)]; + snowmanAnimation.caption:= gameQuestionList[random(gameQuestionList.Count - 1)]; snowmanAnimation.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowman.png'); vTappyTuxDrawer.AddAnimation(snowmanAnimation); @@ -243,26 +250,35 @@ end; procedure TTappyWords.Answered; var i: Integer; + j: Integer; begin - for i:= 1 to 5 do + i:= 0; + j:= vTappyTuxDrawer.GetAnimationCount - 1; + while (i<= j) do begin - if (formTappyTuxGame.Answer.Text = Questions[i].Text) then + if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then begin - Questions[i].Top := 24; - //Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; - Questions[i].Text := gameQuestionList[random(gameQuestionList.Count - 1)]; - gameScore := gameScore +1; - gameLevel := (gameScore div 20) + gameSLevel; - formTappyTuxGame.Score.Text := IntToStr(gameScore); - formTappyTuxGame.Level.Text := IntToStr(gameLevel); + if (vTappyTuxDrawer.GetAnimation(i).caption = formTappyTuxGame.Answer.Text) then + begin + gameScore := gameScore +1; + gameLevel := (gameScore div 20) + gameSLevel; + formTappyTuxGame.Score.Text := IntToStr(gameScore); + formTappyTuxGame.Level.Text := IntToStr(gameLevel); + vTappyTuxDrawer.RemoveAnimation(i); + i := i - 1; + end; end; - end + i := i + 1; + j := vTappyTuxDrawer.GetAnimationCount - 1; + end; + CreateQuestion; end; procedure TTappyWords.EndGame; var i : Integer; + j : Integer; gameOverScreen: TTappySpriteAnimation; continueBtn: TButton; exitBtn: TButton; @@ -279,9 +295,12 @@ begin //gameOverScreen.Bitmaps[0].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'gameover.png'); //vTappyTuxDrawer.AddAnimation(gameOverScreen); - for i:= 1 to vTappyTuxDrawer.GetAnimationCount - 1 do + i:= 0; + j:= vTappyTuxDrawer.GetAnimationCount - 1; + while (i<= j) do begin - vTappyTuxDrawer.GetAnimation(i).Destroy; + vTappyTuxDrawer.RemoveAnimation(i); + j := vTappyTuxDrawer.GetAnimationCount - 1; end; formTappyTuxGame.GameOver.Visible := true; diff --git a/applications/tappytux/tappydrawer.pas b/applications/tappytux/tappydrawer.pas index c59563bce..95e4f955e 100644 --- a/applications/tappytux/tappydrawer.pas +++ b/applications/tappytux/tappydrawer.pas @@ -19,6 +19,8 @@ type CurrentStep: Integer; StepCount: Integer; IsInfinite: Boolean; // if True the animation will never end + caption: String; + value: String; constructor Create; virtual; procedure DrawToIntfImg(AIntfImage: TLazIntfImage); virtual; procedure DrawToCanvas(ACanvas: TCanvas); virtual; @@ -41,8 +43,6 @@ type public //StartPoint, EndPoint: TPoint; override; Bitmap: TFPImageBitmap; - QuestionText: String; - QuestionBox: TCanvas; procedure DrawToIntfImg(AIntfImage: TLazIntfImage); override; procedure DrawToCanvas(ACanvas: TCanvas); override; procedure ExecuteFinal; override; @@ -108,14 +108,12 @@ procedure TFallingText.DrawToIntfImg(AIntfImage: TLazIntfImage); begin TTappyTuxDrawer.DrawImageWithTransparentColor(AIntfImage, Position.X, Position.Y, colFuchsia, Bitmap); - QuestionBox := TCanvas.Create; - //QuestionBox.TextOut(lPos.X, lPos.Y, QuestionText); end; procedure TFallingText.DrawToCanvas(ACanvas: TCanvas); begin //ACanvas.Pixels[CurrentStep, CurrentStep] := clRed; - ACanvas.TextOut(StartPoint.X + 30, StartPoint.Y + 50, QuestionText); + ACanvas.TextOut(Position.X + 30, Position.Y + 50, caption); end; procedure TFallingText.ExecuteFinal; diff --git a/applications/tappytux/tappymodules.pas b/applications/tappytux/tappymodules.pas index 6a354c657..3acdf30ef 100644 --- a/applications/tappytux/tappymodules.pas +++ b/applications/tappytux/tappymodules.pas @@ -95,8 +95,8 @@ var begin lDir := vTappyTuxConfig.GetResourcesDir(); - imgLevel2.LoadFromFile(lDir + 'images'+PathDelim+'levels'+PathDelim+'level2.jpg'); - imgLevel3.LoadFromFile(lDir + 'images'+PathDelim+'levels'+PathDelim+'level3.jpg'); + imgLevel2.LoadFromFile(lDir + 'images'+PathDelim+'levels'+PathDelim+'levelp.jpg'); + imgLevel3.LoadFromFile(lDir + 'images'+PathDelim+'levels'+PathDelim+'levelp.jpg'); end; function TTappyModule.GetBackgroundImage(ALevel: Integer): TJPEGImage;