You've already forked lazarus-ccr
TappyWords is now playable, including 'Score, Level and Lives' components. 'GameOver' has been implemented, and 'Continue' is an option.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2092 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
object formConfig: TformConfig
|
object formConfig: TformConfig
|
||||||
Left = 731
|
Left = 779
|
||||||
Height = 432
|
Height = 432
|
||||||
Top = 390
|
Top = 336
|
||||||
Width = 582
|
Width = 582
|
||||||
Caption = 'TappyTux Loader'
|
Caption = 'TappyTux Loader'
|
||||||
ClientHeight = 432
|
ClientHeight = 432
|
||||||
|
@ -7,7 +7,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
ExtCtrls,
|
ExtCtrls,
|
||||||
tappymodules, gameplayform, tappygamedata;
|
tappymodules, gameplayform{, tappygamedata};
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
object formTappyTuxGame: TformTappyTuxGame
|
object formTappyTuxGame: TformTappyTuxGame
|
||||||
Left = 388
|
Left = 377
|
||||||
Height = 425
|
Height = 425
|
||||||
Top = 200
|
Top = 206
|
||||||
Width = 621
|
Width = 621
|
||||||
Caption = 'Tappy Tux'
|
Caption = 'Tappy Tux'
|
||||||
ClientHeight = 425
|
ClientHeight = 425
|
||||||
@ -106,7 +106,7 @@ object formTappyTuxGame: TformTappyTuxGame
|
|||||||
object Test: TMemo
|
object Test: TMemo
|
||||||
Left = 480
|
Left = 480
|
||||||
Height = 181
|
Height = 181
|
||||||
Top = 24
|
Top = 200
|
||||||
Width = 130
|
Width = 130
|
||||||
Lines.Strings = (
|
Lines.Strings = (
|
||||||
'[TESTE]'
|
'[TESTE]'
|
||||||
@ -117,18 +117,18 @@ object formTappyTuxGame: TformTappyTuxGame
|
|||||||
Visible = False
|
Visible = False
|
||||||
end
|
end
|
||||||
object Question1: TEdit
|
object Question1: TEdit
|
||||||
Left = 120
|
Left = 112
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 216
|
Top = 24
|
||||||
Width = 82
|
Width = 82
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
Text = 'Melancia'
|
Text = 'Melancia'
|
||||||
end
|
end
|
||||||
object Question2: TEdit
|
object Question2: TEdit
|
||||||
Left = 224
|
Left = 216
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 216
|
Top = 24
|
||||||
Width = 80
|
Width = 80
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
@ -137,28 +137,59 @@ object formTappyTuxGame: TformTappyTuxGame
|
|||||||
object Question4: TEdit
|
object Question4: TEdit
|
||||||
Left = 320
|
Left = 320
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 216
|
Top = 24
|
||||||
Width = 80
|
Width = 80
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
Text = 'Cereja'
|
Text = 'Cereja'
|
||||||
end
|
end
|
||||||
object Question3: TEdit
|
object Question3: TEdit
|
||||||
Left = 416
|
Left = 424
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 216
|
Top = 24
|
||||||
Width = 80
|
Width = 80
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 9
|
TabOrder = 9
|
||||||
Text = 'Melão'
|
Text = 'Melão'
|
||||||
end
|
end
|
||||||
object Question5: TEdit
|
object Question5: TEdit
|
||||||
Left = 512
|
Left = 528
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 216
|
Top = 24
|
||||||
Width = 80
|
Width = 80
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 10
|
TabOrder = 10
|
||||||
Text = 'Laranja'
|
Text = 'Laranja'
|
||||||
end
|
end
|
||||||
|
object GameOver: TToggleBox
|
||||||
|
Left = 240
|
||||||
|
Height = 64
|
||||||
|
Top = 152
|
||||||
|
Width = 172
|
||||||
|
Caption = 'Game Over'#13#10'Continue?'
|
||||||
|
Color = clRed
|
||||||
|
TabOrder = 11
|
||||||
|
Visible = False
|
||||||
|
end
|
||||||
|
object Yes: TButton
|
||||||
|
Left = 240
|
||||||
|
Height = 30
|
||||||
|
Top = 219
|
||||||
|
Width = 80
|
||||||
|
Caption = 'Yes'
|
||||||
|
Color = clRed
|
||||||
|
OnClick = YesClick
|
||||||
|
TabOrder = 12
|
||||||
|
Visible = False
|
||||||
|
end
|
||||||
|
object No: TButton
|
||||||
|
Left = 336
|
||||||
|
Height = 30
|
||||||
|
Top = 219
|
||||||
|
Width = 76
|
||||||
|
Caption = 'No'
|
||||||
|
Color = clRed
|
||||||
|
OnClick = NoClick
|
||||||
|
TabOrder = 13
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,6 +17,8 @@ type
|
|||||||
TformTappyTuxGame = class(TForm)
|
TformTappyTuxGame = class(TForm)
|
||||||
btnExit: TButton;
|
btnExit: TButton;
|
||||||
Answer: TEdit;
|
Answer: TEdit;
|
||||||
|
No: TButton;
|
||||||
|
Yes: TButton;
|
||||||
Question2: TEdit;
|
Question2: TEdit;
|
||||||
Question4: TEdit;
|
Question4: TEdit;
|
||||||
Question3: TEdit;
|
Question3: TEdit;
|
||||||
@ -29,9 +31,12 @@ type
|
|||||||
LabelScore: TLabel;
|
LabelScore: TLabel;
|
||||||
LabelLives: TLabel;
|
LabelLives: TLabel;
|
||||||
Test: TMemo;
|
Test: TMemo;
|
||||||
|
GameOver: TToggleBox;
|
||||||
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 NoClick(Sender: TObject);
|
||||||
|
procedure YesClick(Sender: TObject);
|
||||||
|
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
@ -53,10 +58,10 @@ uses gameconfigform, mod_tappywords;
|
|||||||
|
|
||||||
procedure TformTappyTuxGame.btnExitClick(Sender: TObject);
|
procedure TformTappyTuxGame.btnExitClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
GetCurrentModule().EndGame();
|
||||||
Close;
|
Close;
|
||||||
formConfig.Show;
|
formConfig.Show;
|
||||||
|
|
||||||
GetCurrentModule().EndGame();
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformTappyTuxGame.AnswerKeyPress(Sender: TObject; var Key: char);
|
procedure TformTappyTuxGame.AnswerKeyPress(Sender: TObject; var Key: char);
|
||||||
@ -82,6 +87,26 @@ begin
|
|||||||
vTappyTuxDrawer.SendToBack();
|
vTappyTuxDrawer.SendToBack();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TformTappyTuxGame.NoClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
GetCurrentModule().EndGame();
|
||||||
|
Close;
|
||||||
|
formConfig.Show;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TformTappyTuxGame.YesClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Question1.Top := 24;
|
||||||
|
Question2.Top := 24;
|
||||||
|
Question3.Top := 24;
|
||||||
|
Question4.Top := 24;
|
||||||
|
Question5.Top := 24;
|
||||||
|
GetCurrentModule().StartNewGame(formConfig.comboSound.ItemIndex,
|
||||||
|
formConfig.comboMusic.ItemIndex,
|
||||||
|
formConfig.comboLevel.ItemIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ uses
|
|||||||
// LCL
|
// LCL
|
||||||
ExtCtrls,
|
ExtCtrls,
|
||||||
// TappyTux
|
// TappyTux
|
||||||
tappymodules, tappygamedata;
|
tappymodules{, tappygamedata};
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -17,8 +17,14 @@ type
|
|||||||
|
|
||||||
TTappyWords = class(TTappyModule)
|
TTappyWords = class(TTappyModule)
|
||||||
private
|
private
|
||||||
|
gameScore : Integer;
|
||||||
|
gameLives : Integer;
|
||||||
|
gameLevel : Integer;
|
||||||
|
gameSLevel : Integer;
|
||||||
|
gameSndFX : Boolean;
|
||||||
|
gameMusic : Boolean;
|
||||||
timerWords: TTimer;
|
timerWords: TTimer;
|
||||||
newGame : TTappyGameData;
|
{newGame : TTappyGameData;}
|
||||||
procedure HandleOnTimer(Sender: TObject);
|
procedure HandleOnTimer(Sender: TObject);
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
@ -39,11 +45,52 @@ uses tappydrawer, gameplayform;
|
|||||||
procedure TTappyWords.HandleOnTimer(Sender: TObject);
|
procedure TTappyWords.HandleOnTimer(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
//vTappyTuxDrawer.HandleAnimationOnTimer();
|
//vTappyTuxDrawer.HandleAnimationOnTimer();
|
||||||
formTappyTuxGame.Question1.Top:= formTappyTuxGame.Question1.Top + 10;
|
formTappyTuxGame.Question1.Top:= formTappyTuxGame.Question1.Top + (5*gameLevel);
|
||||||
formTappyTuxGame.Question2.Top:= formTappyTuxGame.Question2.Top + 10;
|
formTappyTuxGame.Question2.Top:= formTappyTuxGame.Question2.Top + (5*gameLevel);
|
||||||
formTappyTuxGame.Question3.Top:= formTappyTuxGame.Question3.Top + 10;
|
formTappyTuxGame.Question3.Top:= formTappyTuxGame.Question3.Top + (5*gameLevel);
|
||||||
formTappyTuxGame.Question4.Top:= formTappyTuxGame.Question4.Top + 10;
|
formTappyTuxGame.Question4.Top:= formTappyTuxGame.Question4.Top + (5*gameLevel);
|
||||||
formTappyTuxGame.Question5.Top:= formTappyTuxGame.Question5.Top + 10;
|
formTappyTuxGame.Question5.Top:= formTappyTuxGame.Question5.Top + (5*gameLevel);
|
||||||
|
|
||||||
|
if ((formTappyTuxGame.Question1.Top >= 370)) then
|
||||||
|
begin
|
||||||
|
gameLives := gameLives - 1;
|
||||||
|
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
||||||
|
if (gameLives = 0) then EndGame();
|
||||||
|
formTappyTuxGame.Question1.Top:= 24;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
// Create falling ballons here
|
// Create falling ballons here
|
||||||
//vTappyTuxDrawer.AddAnimation(TBallonAnimation.Create);
|
//vTappyTuxDrawer.AddAnimation(TBallonAnimation.Create);
|
||||||
@ -86,24 +133,78 @@ begin
|
|||||||
//gameData.SetLevel(Level);
|
//gameData.SetLevel(Level);
|
||||||
|
|
||||||
timerWords.Enabled := True;
|
timerWords.Enabled := True;
|
||||||
|
gameScore := 0;
|
||||||
|
gameLives := 5;
|
||||||
|
gameLevel := Level+1;
|
||||||
|
if (Level < 0) then gameLevel := 1;
|
||||||
|
if (SndFX <= 0) then gameSndFX := true;
|
||||||
|
if (SndFX = 1) then gameSndFX := false;
|
||||||
|
if (Music <= 0) then gameMusic := true;
|
||||||
|
if (Music = 1) then gameMusic := false;
|
||||||
|
gameSLevel := gameLevel;
|
||||||
|
|
||||||
//formTappyTuxGame.Question1.Top:= formTappyTuxGame.Question1.Top + timerWords.ComponentCount ;
|
formTappyTuxGame.Answer.ReadOnly := false;
|
||||||
|
formTappyTuxGame.GameOver.Visible := false;
|
||||||
|
formTappyTuxGame.Yes.Visible := false;
|
||||||
|
formTappyTuxGame.No.Visible := false;
|
||||||
|
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
||||||
|
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
||||||
|
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTappyWords.Answered;
|
procedure TTappyWords.Answered;
|
||||||
begin
|
begin
|
||||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question1.Text) then formTappyTuxGame.Question1.Top := 50;
|
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question1.Text) then
|
||||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question2.Text) then formTappyTuxGame.Question2.Top := 50;
|
begin
|
||||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question3.Text) then formTappyTuxGame.Question3.Top := 50;
|
formTappyTuxGame.Question1.Top := 24;
|
||||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question4.Text) then formTappyTuxGame.Question4.Top := 50;
|
gameScore := gameScore +1;
|
||||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question5.Text) then formTappyTuxGame.Question5.Top := 50;
|
gameLevel := (gameScore div 20) + gameSLevel;
|
||||||
|
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
||||||
|
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
||||||
|
end;
|
||||||
|
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question2.Text) then
|
||||||
|
begin
|
||||||
|
formTappyTuxGame.Question2.Top := 24;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
gameScore := gameScore +1;
|
||||||
|
gameLevel := (gameScore div 20) + gameSLevel;
|
||||||
|
formTappyTuxGame.Score.Text := IntToStr(gameScore);
|
||||||
|
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTappyWords.EndGame;
|
procedure TTappyWords.EndGame;
|
||||||
begin
|
begin
|
||||||
timerWords.Enabled := False;
|
timerWords.Enabled := False;
|
||||||
|
formTappyTuxGame.Answer.ReadOnly := true;
|
||||||
|
formTappyTuxGame.GameOver.Visible := true;
|
||||||
|
formTappyTuxGame.Yes.Visible := true;
|
||||||
|
formTappyTuxGame.No.Visible := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Reference in New Issue
Block a user