From e9b3d86b4a9270a1b6ee2e26b5b89abf16f03f39 Mon Sep 17 00:00:00 2001 From: denniscuflat Date: Tue, 25 Oct 2011 22:24:00 +0000 Subject: [PATCH] The question words in TappyWords are now constantly changing. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2093 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/tappytux/gameconfigform.pas | 3 +- applications/tappytux/gameplayform.lfm | 85 +++++++++++++++++++++--- applications/tappytux/gameplayform.pas | 9 ++- applications/tappytux/mod_tappymath.pas | 4 +- applications/tappytux/mod_tappywords.pas | 33 ++++++++- applications/tappytux/tappymodules.pas | 2 +- 6 files changed, 121 insertions(+), 15 deletions(-) diff --git a/applications/tappytux/gameconfigform.pas b/applications/tappytux/gameconfigform.pas index efa3e05d3..08a58dea1 100644 --- a/applications/tappytux/gameconfigform.pas +++ b/applications/tappytux/gameconfigform.pas @@ -78,7 +78,8 @@ procedure TformConfig.btnLoadClick(Sender: TObject); begin SetCurrentModule(comboGameType.ItemIndex); formTappyTuxGame.Show; - GetCurrentModule().StartNewGame(comboSound.ItemIndex, comboMusic.ItemIndex, comboLevel.ItemIndex); + GetCurrentModule().StartNewGame(comboSound.ItemIndex, comboMusic.ItemIndex, + comboLevel.ItemIndex, ltbWordlist.ItemIndex); Hide; end; diff --git a/applications/tappytux/gameplayform.lfm b/applications/tappytux/gameplayform.lfm index 866bc8199..39295f46f 100644 --- a/applications/tappytux/gameplayform.lfm +++ b/applications/tappytux/gameplayform.lfm @@ -109,10 +109,79 @@ object formTappyTuxGame: TformTappyTuxGame Top = 200 Width = 130 Lines.Strings = ( - '[TESTE]' - 'Palavras escritas:' - '' + 'cachorro' + 'gato' + 'peixe' + 'pássaro' + 'macaco' + 'leão' + 'tigre' + 'elefante' + 'crocodilo' + 'abelha' + 'mosca' + 'água-viva' + 'tartaruga' + 'lagartixa' + 'sapo' + 'minhoca' + 'centopéia' + 'rinoceronte' + 'coiote' + 'águia' + 'canguru' + 'coala' + 'morcego' + 'gavião' + 'pavão' + 'cobra' + 'camelo' + 'lontra' + 'tubarão' + 'coelho' + 'baleia' + 'urso' + 'foca' + 'escorpião' + 'touro' + 'vaca' + 'galinha' + 'formiga' + 'borboleta' + 'girafa' + 'arara' + 'salamandra' + 'rã' + 'pinguim' + 'tatu' + 'avestruz' + 'hiena' + 'pelicano' + 'pombo' + 'orangotango' + 'coruja' + 'papagaio' + 'tucano' + 'ornitorrinco' + 'gambá' + 'rato' + 'esquilo' + 'golfinho' + 'ovelha' + 'morsa' + 'suricato' + 'ornitorrinco' + 'toupeira' + 'barata' + 'lula' + 'polvo' + 'tamanduá' + 'camarão' + 'lêmure' + 'besouro' + 'onça' ) + OnChange = TestChange TabOrder = 5 Visible = False end @@ -123,7 +192,7 @@ object formTappyTuxGame: TformTappyTuxGame Width = 82 ReadOnly = True TabOrder = 6 - Text = 'Melancia' + Text = 'Question' end object Question2: TEdit Left = 216 @@ -132,7 +201,7 @@ object formTappyTuxGame: TformTappyTuxGame Width = 80 ReadOnly = True TabOrder = 7 - Text = 'Abacate' + Text = 'Question' end object Question4: TEdit Left = 320 @@ -141,7 +210,7 @@ object formTappyTuxGame: TformTappyTuxGame Width = 80 ReadOnly = True TabOrder = 8 - Text = 'Cereja' + Text = 'Question' end object Question3: TEdit Left = 424 @@ -150,7 +219,7 @@ object formTappyTuxGame: TformTappyTuxGame Width = 80 ReadOnly = True TabOrder = 9 - Text = 'Melão' + Text = 'Question' end object Question5: TEdit Left = 528 @@ -159,7 +228,7 @@ object formTappyTuxGame: TformTappyTuxGame Width = 80 ReadOnly = True TabOrder = 10 - Text = 'Laranja' + Text = 'Question' end object GameOver: TToggleBox Left = 240 diff --git a/applications/tappytux/gameplayform.pas b/applications/tappytux/gameplayform.pas index c435b5e5f..502cf3b95 100644 --- a/applications/tappytux/gameplayform.pas +++ b/applications/tappytux/gameplayform.pas @@ -36,6 +36,7 @@ type procedure AnswerKeyPress(Sender: TObject; var Key: char); procedure FormCreate(Sender: TObject); procedure NoClick(Sender: TObject); + procedure TestChange(Sender: TObject); procedure YesClick(Sender: TObject); private @@ -95,6 +96,11 @@ begin end; +procedure TformTappyTuxGame.TestChange(Sender: TObject); +begin + +end; + procedure TformTappyTuxGame.YesClick(Sender: TObject); begin Question1.Top := 24; @@ -104,7 +110,8 @@ begin Question5.Top := 24; GetCurrentModule().StartNewGame(formConfig.comboSound.ItemIndex, formConfig.comboMusic.ItemIndex, - formConfig.comboLevel.ItemIndex); + formConfig.comboLevel.ItemIndex, + formConfig.ltbWordlist.ItemIndex); end; diff --git a/applications/tappytux/mod_tappymath.pas b/applications/tappytux/mod_tappymath.pas index aee4e717c..784de6c78 100644 --- a/applications/tappytux/mod_tappymath.pas +++ b/applications/tappytux/mod_tappymath.pas @@ -20,7 +20,7 @@ type constructor Create; override; procedure TranslateTextsToEnglish; override; procedure TranslateTextsToPortuguese; override; - procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer); override; + procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer); override; procedure Answered(); override; procedure EndGame(); override; end; @@ -46,7 +46,7 @@ begin ShortDescription := 'TappyMath - Um jogo para aprender aritmética'; end; -procedure TTappyMath.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer); +procedure TTappyMath.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer); begin end; diff --git a/applications/tappytux/mod_tappywords.pas b/applications/tappytux/mod_tappywords.pas index dede3a5ac..9b0cea293 100644 --- a/applications/tappytux/mod_tappywords.pas +++ b/applications/tappytux/mod_tappywords.pas @@ -23,6 +23,9 @@ type gameSLevel : Integer; gameSndFX : Boolean; gameMusic : Boolean; + gameQuestionList : Integer; + gameFile : Text; + aux : string; timerWords: TTimer; {newGame : TTappyGameData;} procedure HandleOnTimer(Sender: TObject); @@ -31,7 +34,7 @@ type destructor Destroy; override; procedure TranslateTextsToEnglish; override; procedure TranslateTextsToPortuguese; override; - procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer); override; + procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer); override; procedure Answered(); override; procedure EndGame(); override; end; @@ -57,6 +60,7 @@ begin formTappyTuxGame.Lives.Text := IntToStr(gameLives); if (gameLives = 0) then EndGame(); formTappyTuxGame.Question1.Top:= 24; + formTappyTuxGame.Question1.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; end; if ((formTappyTuxGame.Question2.Top >= 370)) then @@ -65,6 +69,7 @@ begin formTappyTuxGame.Lives.Text := IntToStr(gameLives); if (gameLives = 0) then EndGame(); formTappyTuxGame.Question2.Top:= 24; + formTappyTuxGame.Question2.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; end; if ((formTappyTuxGame.Question3.Top >= 370)) then @@ -73,6 +78,7 @@ begin formTappyTuxGame.Lives.Text := IntToStr(gameLives); if (gameLives = 0) then EndGame(); formTappyTuxGame.Question3.Top:= 24; + formTappyTuxGame.Question3.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; end; if ((formTappyTuxGame.Question4.Top >= 370)) then @@ -81,6 +87,7 @@ begin formTappyTuxGame.Lives.Text := IntToStr(gameLives); if (gameLives = 0) then EndGame(); formTappyTuxGame.Question4.Top:= 24; + formTappyTuxGame.Question4.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; end; if ((formTappyTuxGame.Question5.Top >= 370)) then @@ -89,6 +96,7 @@ begin formTappyTuxGame.Lives.Text := IntToStr(gameLives); if (gameLives = 0) then EndGame(); formTappyTuxGame.Question5.Top:= 24; + formTappyTuxGame.Question5.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; end; @@ -124,7 +132,7 @@ begin ShortDescription := 'TappyWords - Um jogo para aprender a digitar e ortografia'; end; -procedure TTappyWords.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer); +procedure TTappyWords.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer); begin //Causam "External: SIGSEGV" @@ -151,6 +159,22 @@ begin formTappyTuxGame.Score.Text := IntToStr(gameScore); formTappyTuxGame.Lives.Text := IntToStr(gameLives); + formTappyTuxGame.Question1.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; + formTappyTuxGame.Question2.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; + formTappyTuxGame.Question3.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; + formTappyTuxGame.Question4.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; + formTappyTuxGame.Question5.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; + + //gameQuestionList := QuestionList; + //if gameQuestionList < 0 then gameQuestionList := 0; + //Assign(gameFile, {IntToStr(gameQuestionList)}'4.txt') + //gameFile := SearchFile; + //Reset(gameFile); + //Readln(gameFile, aux); + //formTappyTuxGame.Question1.Text := aux; + + //Assign(gameFile, gameQuestionList+'.txt'); + end; procedure TTappyWords.Answered; @@ -158,6 +182,7 @@ begin if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question1.Text) then begin formTappyTuxGame.Question1.Top := 24; + formTappyTuxGame.Question1.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; gameScore := gameScore +1; gameLevel := (gameScore div 20) + gameSLevel; formTappyTuxGame.Score.Text := IntToStr(gameScore); @@ -166,6 +191,7 @@ begin if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question2.Text) then begin formTappyTuxGame.Question2.Top := 24; + formTappyTuxGame.Question2.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; gameScore := gameScore +1; gameLevel := (gameScore div 20) + gameSLevel; formTappyTuxGame.Score.Text := IntToStr(gameScore); @@ -174,6 +200,7 @@ begin if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question3.Text) then begin formTappyTuxGame.Question3.Top := 24; + formTappyTuxGame.Question3.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; gameScore := gameScore +1; gameLevel := (gameScore div 20) + gameSLevel; formTappyTuxGame.Score.Text := IntToStr(gameScore); @@ -182,6 +209,7 @@ begin if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question4.Text) then begin formTappyTuxGame.Question4.Top := 24; + formTappyTuxGame.Question4.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; gameScore := gameScore +1; gameLevel := (gameScore div 20) + gameSLevel; formTappyTuxGame.Score.Text := IntToStr(gameScore); @@ -190,6 +218,7 @@ begin if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question5.Text) then begin formTappyTuxGame.Question5.Top := 24; + formTappyTuxGame.Question5.Text := formTappyTuxGame.Test.Lines.Strings[random(71)]; gameScore := gameScore +1; gameLevel := (gameScore div 20) + gameSLevel; formTappyTuxGame.Score.Text := IntToStr(gameScore); diff --git a/applications/tappytux/tappymodules.pas b/applications/tappytux/tappymodules.pas index 4a6c98e4c..576efa8a5 100644 --- a/applications/tappytux/tappymodules.pas +++ b/applications/tappytux/tappymodules.pas @@ -24,7 +24,7 @@ type procedure TranslateTextsToEnglish; virtual; procedure TranslateTextsToPortuguese; virtual; procedure InitModule(); virtual; - procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer); virtual; abstract; + procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer); virtual; abstract; procedure Answered(); virtual; abstract; procedure EndGame(); virtual; abstract; end;