You've already forked lazarus-ccr
Questions are now assigned to an array, which allows for a smaller and better code.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2128 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -6,8 +6,10 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
|
// LCL
|
||||||
ExtCtrls,
|
ExtCtrls,
|
||||||
tappymodules, gameplayform{, tappygamedata};
|
// TappyTux
|
||||||
|
tappymodules, gameplayform;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
object formTappyTuxGame: TformTappyTuxGame
|
object formTappyTuxGame: TformTappyTuxGame
|
||||||
Left = 377
|
Left = 375
|
||||||
Height = 425
|
Height = 425
|
||||||
Top = 206
|
Top = 210
|
||||||
Width = 621
|
Width = 621
|
||||||
Caption = 'Tappy Tux'
|
Caption = 'Tappy Tux'
|
||||||
ClientHeight = 425
|
ClientHeight = 425
|
||||||
ClientWidth = 621
|
ClientWidth = 621
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
|
OnShow = FormShow
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '0.9.31'
|
||||||
object btnExit: TButton
|
object btnExit: TButton
|
||||||
Left = 8
|
Left = 8
|
||||||
|
@ -6,9 +6,10 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
|
// LCL
|
||||||
ExtCtrls,
|
ExtCtrls,
|
||||||
// TappyTux
|
// TappyTux
|
||||||
{GameData,} tappydrawer, tappymodules;
|
tappydrawer, tappymodules;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ type
|
|||||||
Answer: TEdit;
|
Answer: TEdit;
|
||||||
No: TButton;
|
No: TButton;
|
||||||
Yes: TButton;
|
Yes: TButton;
|
||||||
|
Question1: TEdit;
|
||||||
Question2: TEdit;
|
Question2: TEdit;
|
||||||
Question4: TEdit;
|
Question4: TEdit;
|
||||||
Question3: TEdit;
|
Question3: TEdit;
|
||||||
@ -26,7 +28,6 @@ type
|
|||||||
Level: TEdit;
|
Level: TEdit;
|
||||||
Score: TEdit;
|
Score: TEdit;
|
||||||
Lives: TEdit;
|
Lives: TEdit;
|
||||||
Question1: TEdit;
|
|
||||||
LabelLevels: TLabel;
|
LabelLevels: TLabel;
|
||||||
LabelScore: TLabel;
|
LabelScore: TLabel;
|
||||||
LabelLives: TLabel;
|
LabelLives: TLabel;
|
||||||
@ -35,6 +36,7 @@ type
|
|||||||
procedure btnExitClick(Sender: TObject);
|
procedure btnExitClick(Sender: TObject);
|
||||||
procedure AnswerKeyPress(Sender: TObject; var Key: char);
|
procedure AnswerKeyPress(Sender: TObject; var Key: char);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
procedure NoClick(Sender: TObject);
|
procedure NoClick(Sender: TObject);
|
||||||
procedure TestChange(Sender: TObject);
|
procedure TestChange(Sender: TObject);
|
||||||
procedure YesClick(Sender: TObject);
|
procedure YesClick(Sender: TObject);
|
||||||
@ -48,6 +50,7 @@ type
|
|||||||
|
|
||||||
var
|
var
|
||||||
formTappyTuxGame: TformTappyTuxGame;
|
formTappyTuxGame: TformTappyTuxGame;
|
||||||
|
Questions : array[1..5] of TEdit;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -86,6 +89,17 @@ begin
|
|||||||
vTappyTuxDrawer.Height := Height-vTappyTuxDrawer.Top;
|
vTappyTuxDrawer.Height := Height-vTappyTuxDrawer.Top;
|
||||||
vTappyTuxDrawer.Width := Width-vTappyTuxDrawer.Left;
|
vTappyTuxDrawer.Width := Width-vTappyTuxDrawer.Left;
|
||||||
vTappyTuxDrawer.SendToBack();
|
vTappyTuxDrawer.SendToBack();
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TformTappyTuxGame.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Questions[1] := Question1;
|
||||||
|
Questions[2] := Question2;
|
||||||
|
Questions[3] := Question3;
|
||||||
|
Questions[4] := Question4;
|
||||||
|
Questions[5] := Question5;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformTappyTuxGame.NoClick(Sender: TObject);
|
procedure TformTappyTuxGame.NoClick(Sender: TObject);
|
||||||
@ -102,12 +116,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformTappyTuxGame.YesClick(Sender: TObject);
|
procedure TformTappyTuxGame.YesClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Question1.Top := 24;
|
for i:= 1 to 5 do
|
||||||
Question2.Top := 24;
|
begin
|
||||||
Question3.Top := 24;
|
Questions[i].Top := 24;
|
||||||
Question4.Top := 24;
|
end;
|
||||||
Question5.Top := 24;
|
|
||||||
GetCurrentModule().StartNewGame(formConfig.comboSound.ItemIndex,
|
GetCurrentModule().StartNewGame(formConfig.comboSound.ItemIndex,
|
||||||
formConfig.comboMusic.ItemIndex,
|
formConfig.comboMusic.ItemIndex,
|
||||||
formConfig.comboLevel.ItemIndex,
|
formConfig.comboLevel.ItemIndex,
|
||||||
|
@ -16,6 +16,7 @@ type
|
|||||||
{ TTappyMath }
|
{ TTappyMath }
|
||||||
|
|
||||||
TTappyMath = class(TTappyModule)
|
TTappyMath = class(TTappyModule)
|
||||||
|
|
||||||
private
|
private
|
||||||
gameScore : Integer;
|
gameScore : Integer;
|
||||||
gameLives : Integer;
|
gameLives : Integer;
|
||||||
@ -25,9 +26,9 @@ type
|
|||||||
gameMusic : Boolean;
|
gameMusic : Boolean;
|
||||||
questionType : array[1..3] of Integer;
|
questionType : array[1..3] of Integer;
|
||||||
questionAnswer : array[1..5] of Integer;
|
questionAnswer : array[1..5] of Integer;
|
||||||
questionNumber : Integer;
|
|
||||||
timerMath : TTimer;
|
timerMath : TTimer;
|
||||||
procedure HandleOnTimer(Sender: TObject);
|
procedure HandleOnTimer(Sender: TObject);
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -41,63 +42,26 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses tappydrawer, gameplayform {,tappygamedata};
|
uses tappydrawer, gameplayform;
|
||||||
|
|
||||||
{ TTappyMath }
|
{ TTappyMath }
|
||||||
|
|
||||||
procedure TTappyMath.HandleOnTimer(Sender: TObject);
|
procedure TTappyMath.HandleOnTimer(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
for i:= 1 to 5 do
|
||||||
formTappyTuxGame.Question1.Top:= formTappyTuxGame.Question1.Top + (5*gameLevel);
|
|
||||||
formTappyTuxGame.Question2.Top:= formTappyTuxGame.Question2.Top + (5*gameLevel);
|
|
||||||
formTappyTuxGame.Question3.Top:= formTappyTuxGame.Question3.Top + (5*gameLevel);
|
|
||||||
formTappyTuxGame.Question4.Top:= formTappyTuxGame.Question4.Top + (5*gameLevel);
|
|
||||||
formTappyTuxGame.Question5.Top:= formTappyTuxGame.Question5.Top + (5*gameLevel);
|
|
||||||
|
|
||||||
if ((formTappyTuxGame.Question1.Top >= 370)) then
|
|
||||||
begin
|
begin
|
||||||
|
Questions[i].Top := Questions[i].Top + (5*gameLevel);
|
||||||
|
if ((Questions[i].Top >= 370)) then
|
||||||
|
begin
|
||||||
gameLives := gameLives - 1;
|
gameLives := gameLives - 1;
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
||||||
if (gameLives = 0) then EndGame();
|
if (gameLives = 0) then EndGame();
|
||||||
formTappyTuxGame.Question1.Top:= 24;
|
Questions[i].Top:= 24;
|
||||||
QuestionGenerator(1);
|
QuestionGenerator(i);
|
||||||
end;
|
end;
|
||||||
|
end
|
||||||
if ((formTappyTuxGame.Question2.Top >= 370)) then
|
|
||||||
begin
|
|
||||||
gameLives := gameLives - 1;
|
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
|
||||||
if (gameLives = 0) then EndGame();
|
|
||||||
formTappyTuxGame.Question2.Top:= 24;
|
|
||||||
QuestionGenerator(2);
|
|
||||||
end;
|
|
||||||
|
|
||||||
if ((formTappyTuxGame.Question3.Top >= 370)) then
|
|
||||||
begin
|
|
||||||
gameLives := gameLives - 1;
|
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
|
||||||
if (gameLives = 0) then EndGame();
|
|
||||||
formTappyTuxGame.Question3.Top:= 24;
|
|
||||||
QuestionGenerator(3);
|
|
||||||
end;
|
|
||||||
|
|
||||||
if ((formTappyTuxGame.Question4.Top >= 370)) then
|
|
||||||
begin
|
|
||||||
gameLives := gameLives - 1;
|
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
|
||||||
if (gameLives = 0) then EndGame();
|
|
||||||
formTappyTuxGame.Question4.Top:= 24;
|
|
||||||
QuestionGenerator(4);
|
|
||||||
end;
|
|
||||||
|
|
||||||
if ((formTappyTuxGame.Question5.Top >= 370)) then
|
|
||||||
begin
|
|
||||||
gameLives := gameLives - 1;
|
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
|
||||||
if (gameLives = 0) then EndGame();
|
|
||||||
formTappyTuxGame.Question5.Top:= 24;
|
|
||||||
QuestionGenerator(5);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -130,6 +94,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTappyMath.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer);
|
procedure TTappyMath.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
timerMath.Enabled := True;
|
timerMath.Enabled := True;
|
||||||
@ -151,62 +117,29 @@ begin
|
|||||||
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
||||||
|
|
||||||
QuestionGenerator(1);
|
for i:= 1 to 5 do
|
||||||
QuestionGenerator(2);
|
begin
|
||||||
QuestionGenerator(3);
|
QuestionGenerator(i);
|
||||||
QuestionGenerator(4);
|
end
|
||||||
QuestionGenerator(5);
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTappyMath.Answered;
|
procedure TTappyMath.Answered;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
for i:= 1 to 5 do
|
||||||
if (formTappyTuxGame.Answer.Text = IntToStr(questionAnswer[1])) then
|
|
||||||
begin
|
begin
|
||||||
formTappyTuxGame.Question1.Top := 24;
|
if (formTappyTuxGame.Answer.Text = IntToStr(questionAnswer[i])) then
|
||||||
QuestionGenerator(1);
|
begin
|
||||||
|
Questions[i].Top := 24;
|
||||||
|
QuestionGenerator(i);
|
||||||
gameScore := gameScore +1;
|
gameScore := gameScore +1;
|
||||||
gameLevel := (gameScore div 20) + gameSLevel;
|
gameLevel := (gameScore div 20) + gameSLevel;
|
||||||
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
||||||
end;
|
end;
|
||||||
if (formTappyTuxGame.Answer.Text = IntToStr(questionAnswer[2])) then
|
end
|
||||||
begin
|
|
||||||
formTappyTuxGame.Question2.Top := 24;
|
|
||||||
QuestionGenerator(2);
|
|
||||||
gameScore := gameScore +1;
|
|
||||||
gameLevel := (gameScore div 20) + gameSLevel;
|
|
||||||
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
|
||||||
end;
|
|
||||||
if (formTappyTuxGame.Answer.Text = IntToStr(questionAnswer[3])) then
|
|
||||||
begin
|
|
||||||
formTappyTuxGame.Question3.Top := 24;
|
|
||||||
QuestionGenerator(3);
|
|
||||||
gameScore := gameScore +1;
|
|
||||||
gameLevel := (gameScore div 20) + gameSLevel;
|
|
||||||
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
|
||||||
end;
|
|
||||||
if (formTappyTuxGame.Answer.Text = IntToStr(questionAnswer[4])) then
|
|
||||||
begin
|
|
||||||
formTappyTuxGame.Question4.Top := 24;
|
|
||||||
QuestionGenerator(4);
|
|
||||||
gameScore := gameScore +1;
|
|
||||||
gameLevel := (gameScore div 20) + gameSLevel;
|
|
||||||
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
|
||||||
end;
|
|
||||||
if (formTappyTuxGame.Answer.Text = IntToStr(questionAnswer[5])) then
|
|
||||||
begin
|
|
||||||
formTappyTuxGame.Question5.Top := 24;
|
|
||||||
QuestionGenerator(5);
|
|
||||||
gameScore := gameScore +1;
|
|
||||||
gameLevel := (gameScore div 20) + gameSLevel;
|
|
||||||
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -229,33 +162,21 @@ begin
|
|||||||
questionType[2] := random(21);
|
questionType[2] := random(21);
|
||||||
questionType[3] := random(21);
|
questionType[3] := random(21);
|
||||||
questionAnswer[qNumber] := questionType[2] + questionType[3];
|
questionAnswer[qNumber] := questionType[2] + questionType[3];
|
||||||
if (qNumber = 1) then formTappyTuxGame.Question1.Text := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]);
|
Questions[qNumber].Text := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]);
|
||||||
if (qNumber = 2) then formTappyTuxGame.Question2.Text := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 3) then formTappyTuxGame.Question3.Text := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 4) then formTappyTuxGame.Question4.Text := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 5) then formTappyTuxGame.Question5.Text := IntToStr(questionType[2])+' + ' +IntToStr(questionType[3]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
1: begin
|
1: begin
|
||||||
questionType[2] := random(21);
|
questionType[2] := random(21);
|
||||||
questionType[3] := random(questionType[2]);
|
questionType[3] := random(questionType[2]);
|
||||||
questionAnswer[qNumber] := questionType[2] - questionType[3];
|
questionAnswer[qNumber] := questionType[2] - questionType[3];
|
||||||
if (qNumber = 1) then formTappyTuxGame.Question1.Text := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]);
|
Questions[qNumber].Text := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]);
|
||||||
if (qNumber = 2) then formTappyTuxGame.Question2.Text := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 3) then formTappyTuxGame.Question3.Text := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 4) then formTappyTuxGame.Question4.Text := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 5) then formTappyTuxGame.Question5.Text := IntToStr(questionType[2])+' - ' +IntToStr(questionType[3]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
2: begin
|
2: begin
|
||||||
questionType[2] := random(11);
|
questionType[2] := random(11);
|
||||||
questionType[3] := random(11);
|
questionType[3] := random(11);
|
||||||
questionAnswer[qNumber] := questionType[2] * questionType[3];
|
questionAnswer[qNumber] := questionType[2] * questionType[3];
|
||||||
if (qNumber = 1) then formTappyTuxGame.Question1.Text := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]);
|
Questions[qNumber].Text := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]);
|
||||||
if (qNumber = 2) then formTappyTuxGame.Question2.Text := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 3) then formTappyTuxGame.Question3.Text := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 4) then formTappyTuxGame.Question4.Text := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]);
|
|
||||||
if (qNumber = 5) then formTappyTuxGame.Question5.Text := IntToStr(questionType[2])+' x ' +IntToStr(questionType[3]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -5,17 +5,18 @@ unit mod_tappywords;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils, FileUtil,
|
||||||
// LCL
|
// LCL
|
||||||
ExtCtrls,
|
ExtCtrls,
|
||||||
// TappyTux
|
// TappyTux
|
||||||
tappymodules{, tappygamedata};
|
tappyconfig, tappymodules;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TTappyWords }
|
{ TTappyWords }
|
||||||
|
|
||||||
TTappyWords = class(TTappyModule)
|
TTappyWords = class(TTappyModule)
|
||||||
|
|
||||||
private
|
private
|
||||||
gameScore : Integer;
|
gameScore : Integer;
|
||||||
gameLives : Integer;
|
gameLives : Integer;
|
||||||
@ -24,11 +25,9 @@ type
|
|||||||
gameSndFX : Boolean;
|
gameSndFX : Boolean;
|
||||||
gameMusic : Boolean;
|
gameMusic : Boolean;
|
||||||
gameQuestionList : Integer;
|
gameQuestionList : Integer;
|
||||||
gameFile : Text;
|
|
||||||
aux : string;
|
|
||||||
timerWords: TTimer;
|
timerWords: TTimer;
|
||||||
{newGame : TTappyGameData;}
|
|
||||||
procedure HandleOnTimer(Sender: TObject);
|
procedure HandleOnTimer(Sender: TObject);
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -39,6 +38,7 @@ type
|
|||||||
procedure EndGame(); override;
|
procedure EndGame(); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses tappydrawer, gameplayform;
|
uses tappydrawer, gameplayform;
|
||||||
@ -46,62 +46,22 @@ uses tappydrawer, gameplayform;
|
|||||||
{ TTappyWords }
|
{ TTappyWords }
|
||||||
|
|
||||||
procedure TTappyWords.HandleOnTimer(Sender: TObject);
|
procedure TTappyWords.HandleOnTimer(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
//vTappyTuxDrawer.HandleAnimationOnTimer();
|
for i:= 1 to 5 do
|
||||||
formTappyTuxGame.Question1.Top:= formTappyTuxGame.Question1.Top + (5*gameLevel);
|
|
||||||
formTappyTuxGame.Question2.Top:= formTappyTuxGame.Question2.Top + (5*gameLevel);
|
|
||||||
formTappyTuxGame.Question3.Top:= formTappyTuxGame.Question3.Top + (5*gameLevel);
|
|
||||||
formTappyTuxGame.Question4.Top:= formTappyTuxGame.Question4.Top + (5*gameLevel);
|
|
||||||
formTappyTuxGame.Question5.Top:= formTappyTuxGame.Question5.Top + (5*gameLevel);
|
|
||||||
|
|
||||||
if ((formTappyTuxGame.Question1.Top >= 370)) then
|
|
||||||
begin
|
begin
|
||||||
|
Questions[i].Top := Questions[i].Top + (5*gameLevel);
|
||||||
|
if ((Questions[i].Top >= 370)) then
|
||||||
|
begin
|
||||||
gameLives := gameLives - 1;
|
gameLives := gameLives - 1;
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
||||||
if (gameLives = 0) then EndGame();
|
if (gameLives = 0) then EndGame();
|
||||||
formTappyTuxGame.Question1.Top:= 24;
|
Questions[i].Top:= 24;
|
||||||
formTappyTuxGame.Question1.Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
||||||
end;
|
end;
|
||||||
|
end
|
||||||
|
|
||||||
if ((formTappyTuxGame.Question2.Top >= 370)) then
|
|
||||||
begin
|
|
||||||
gameLives := gameLives - 1;
|
|
||||||
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
|
|
||||||
begin
|
|
||||||
gameLives := gameLives - 1;
|
|
||||||
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
|
|
||||||
begin
|
|
||||||
gameLives := gameLives - 1;
|
|
||||||
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
|
|
||||||
begin
|
|
||||||
gameLives := gameLives - 1;
|
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
|
||||||
if (gameLives = 0) then EndGame();
|
|
||||||
formTappyTuxGame.Question5.Top:= 24;
|
|
||||||
formTappyTuxGame.Question5.Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
// Create falling ballons here
|
|
||||||
//vTappyTuxDrawer.AddAnimation(TBallonAnimation.Create);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TTappyWords.Create;
|
constructor TTappyWords.Create;
|
||||||
@ -133,13 +93,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTappyWords.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer);
|
procedure TTappyWords.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
//Causam "External: SIGSEGV"
|
|
||||||
//gameData.SetSndFX(SndFX);
|
|
||||||
//gameData.SetMusic(Music);
|
|
||||||
//gameData.SetLevel(Level);
|
|
||||||
|
|
||||||
timerWords.Enabled := True;
|
timerWords.Enabled := True;
|
||||||
gameScore := 0;
|
gameScore := 0;
|
||||||
gameLives := 5;
|
gameLives := 5;
|
||||||
@ -159,71 +115,29 @@ begin
|
|||||||
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
||||||
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
||||||
|
|
||||||
formTappyTuxGame.Question1.Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
for i:= 1 to 5 do
|
||||||
formTappyTuxGame.Question2.Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
begin
|
||||||
formTappyTuxGame.Question3.Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
||||||
formTappyTuxGame.Question4.Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
end
|
||||||
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;
|
end;
|
||||||
|
|
||||||
procedure TTappyWords.Answered;
|
procedure TTappyWords.Answered;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question1.Text) then
|
for i:= 1 to 5 do
|
||||||
begin
|
begin
|
||||||
formTappyTuxGame.Question1.Top := 24;
|
if (formTappyTuxGame.Answer.Text = Questions[i].Text) then
|
||||||
formTappyTuxGame.Question1.Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
begin
|
||||||
|
Questions[i].Top := 24;
|
||||||
|
Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
||||||
gameScore := gameScore +1;
|
gameScore := gameScore +1;
|
||||||
gameLevel := (gameScore div 20) + gameSLevel;
|
gameLevel := (gameScore div 20) + gameSLevel;
|
||||||
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
||||||
end;
|
end;
|
||||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question2.Text) then
|
end
|
||||||
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);
|
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
|
||||||
end;
|
|
||||||
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);
|
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
|
||||||
end;
|
|
||||||
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);
|
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
|
||||||
end;
|
|
||||||
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);
|
|
||||||
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Graphics,
|
Classes, SysUtils, Graphics,
|
||||||
|
// TappyTux
|
||||||
tappyconfig;
|
tappyconfig;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -95,7 +96,6 @@ begin
|
|||||||
|
|
||||||
imgLevel2.LoadFromFile(lDir + 'images'+PathDelim+'levels'+PathDelim+'level2.jpg');
|
imgLevel2.LoadFromFile(lDir + 'images'+PathDelim+'levels'+PathDelim+'level2.jpg');
|
||||||
imgLevel3.LoadFromFile(lDir + 'images'+PathDelim+'levels'+PathDelim+'level3.jpg');
|
imgLevel3.LoadFromFile(lDir + 'images'+PathDelim+'levels'+PathDelim+'level3.jpg');
|
||||||
//imgPenguim.LoadFromFile(lDir + 'images'+PathDelim+'sprites'+PathDelim+'tuxside.xmp');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTappyModule.GetBackgroundImage(ALevel: Integer): TJPEGImage;
|
function TTappyModule.GetBackgroundImage(ALevel: Integer): TJPEGImage;
|
||||||
|
Reference in New Issue
Block a user