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
|
||||
Left = 731
|
||||
Left = 779
|
||||
Height = 432
|
||||
Top = 390
|
||||
Top = 336
|
||||
Width = 582
|
||||
Caption = 'TappyTux Loader'
|
||||
ClientHeight = 432
|
||||
|
@ -7,7 +7,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
ExtCtrls,
|
||||
tappymodules, gameplayform, tappygamedata;
|
||||
tappymodules, gameplayform{, tappygamedata};
|
||||
|
||||
type
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
object formTappyTuxGame: TformTappyTuxGame
|
||||
Left = 388
|
||||
Left = 377
|
||||
Height = 425
|
||||
Top = 200
|
||||
Top = 206
|
||||
Width = 621
|
||||
Caption = 'Tappy Tux'
|
||||
ClientHeight = 425
|
||||
@ -106,7 +106,7 @@ object formTappyTuxGame: TformTappyTuxGame
|
||||
object Test: TMemo
|
||||
Left = 480
|
||||
Height = 181
|
||||
Top = 24
|
||||
Top = 200
|
||||
Width = 130
|
||||
Lines.Strings = (
|
||||
'[TESTE]'
|
||||
@ -117,18 +117,18 @@ object formTappyTuxGame: TformTappyTuxGame
|
||||
Visible = False
|
||||
end
|
||||
object Question1: TEdit
|
||||
Left = 120
|
||||
Left = 112
|
||||
Height = 23
|
||||
Top = 216
|
||||
Top = 24
|
||||
Width = 82
|
||||
ReadOnly = True
|
||||
TabOrder = 6
|
||||
Text = 'Melancia'
|
||||
end
|
||||
object Question2: TEdit
|
||||
Left = 224
|
||||
Left = 216
|
||||
Height = 23
|
||||
Top = 216
|
||||
Top = 24
|
||||
Width = 80
|
||||
ReadOnly = True
|
||||
TabOrder = 7
|
||||
@ -137,28 +137,59 @@ object formTappyTuxGame: TformTappyTuxGame
|
||||
object Question4: TEdit
|
||||
Left = 320
|
||||
Height = 23
|
||||
Top = 216
|
||||
Top = 24
|
||||
Width = 80
|
||||
ReadOnly = True
|
||||
TabOrder = 8
|
||||
Text = 'Cereja'
|
||||
end
|
||||
object Question3: TEdit
|
||||
Left = 416
|
||||
Left = 424
|
||||
Height = 23
|
||||
Top = 216
|
||||
Top = 24
|
||||
Width = 80
|
||||
ReadOnly = True
|
||||
TabOrder = 9
|
||||
Text = 'Melão'
|
||||
end
|
||||
object Question5: TEdit
|
||||
Left = 512
|
||||
Left = 528
|
||||
Height = 23
|
||||
Top = 216
|
||||
Top = 24
|
||||
Width = 80
|
||||
ReadOnly = True
|
||||
TabOrder = 10
|
||||
Text = 'Laranja'
|
||||
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
|
||||
|
@ -17,6 +17,8 @@ type
|
||||
TformTappyTuxGame = class(TForm)
|
||||
btnExit: TButton;
|
||||
Answer: TEdit;
|
||||
No: TButton;
|
||||
Yes: TButton;
|
||||
Question2: TEdit;
|
||||
Question4: TEdit;
|
||||
Question3: TEdit;
|
||||
@ -29,9 +31,12 @@ type
|
||||
LabelScore: TLabel;
|
||||
LabelLives: TLabel;
|
||||
Test: TMemo;
|
||||
GameOver: TToggleBox;
|
||||
procedure btnExitClick(Sender: TObject);
|
||||
procedure AnswerKeyPress(Sender: TObject; var Key: char);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure NoClick(Sender: TObject);
|
||||
procedure YesClick(Sender: TObject);
|
||||
|
||||
private
|
||||
{ private declarations }
|
||||
@ -53,10 +58,10 @@ uses gameconfigform, mod_tappywords;
|
||||
|
||||
procedure TformTappyTuxGame.btnExitClick(Sender: TObject);
|
||||
begin
|
||||
GetCurrentModule().EndGame();
|
||||
Close;
|
||||
formConfig.Show;
|
||||
|
||||
GetCurrentModule().EndGame();
|
||||
end;
|
||||
|
||||
procedure TformTappyTuxGame.AnswerKeyPress(Sender: TObject; var Key: char);
|
||||
@ -82,6 +87,26 @@ begin
|
||||
vTappyTuxDrawer.SendToBack();
|
||||
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.
|
||||
|
||||
|
@ -9,7 +9,7 @@ uses
|
||||
// LCL
|
||||
ExtCtrls,
|
||||
// TappyTux
|
||||
tappymodules, tappygamedata;
|
||||
tappymodules{, tappygamedata};
|
||||
|
||||
type
|
||||
|
||||
@ -17,8 +17,14 @@ type
|
||||
|
||||
TTappyWords = class(TTappyModule)
|
||||
private
|
||||
gameScore : Integer;
|
||||
gameLives : Integer;
|
||||
gameLevel : Integer;
|
||||
gameSLevel : Integer;
|
||||
gameSndFX : Boolean;
|
||||
gameMusic : Boolean;
|
||||
timerWords: TTimer;
|
||||
newGame : TTappyGameData;
|
||||
{newGame : TTappyGameData;}
|
||||
procedure HandleOnTimer(Sender: TObject);
|
||||
public
|
||||
constructor Create; override;
|
||||
@ -39,11 +45,52 @@ uses tappydrawer, gameplayform;
|
||||
procedure TTappyWords.HandleOnTimer(Sender: TObject);
|
||||
begin
|
||||
//vTappyTuxDrawer.HandleAnimationOnTimer();
|
||||
formTappyTuxGame.Question1.Top:= formTappyTuxGame.Question1.Top + 10;
|
||||
formTappyTuxGame.Question2.Top:= formTappyTuxGame.Question2.Top + 10;
|
||||
formTappyTuxGame.Question3.Top:= formTappyTuxGame.Question3.Top + 10;
|
||||
formTappyTuxGame.Question4.Top:= formTappyTuxGame.Question4.Top + 10;
|
||||
formTappyTuxGame.Question5.Top:= formTappyTuxGame.Question5.Top + 10;
|
||||
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
|
||||
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
|
||||
//vTappyTuxDrawer.AddAnimation(TBallonAnimation.Create);
|
||||
@ -86,24 +133,78 @@ begin
|
||||
//gameData.SetLevel(Level);
|
||||
|
||||
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;
|
||||
begin
|
||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question1.Text) then formTappyTuxGame.Question1.Top := 50;
|
||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question2.Text) then formTappyTuxGame.Question2.Top := 50;
|
||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question3.Text) then formTappyTuxGame.Question3.Top := 50;
|
||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question4.Text) then formTappyTuxGame.Question4.Top := 50;
|
||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question5.Text) then formTappyTuxGame.Question5.Top := 50;
|
||||
if (formTappyTuxGame.Answer.Text = formTappyTuxGame.Question1.Text) then
|
||||
begin
|
||||
formTappyTuxGame.Question1.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.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;
|
||||
|
||||
procedure TTappyWords.EndGame;
|
||||
begin
|
||||
timerWords.Enabled := False;
|
||||
formTappyTuxGame.Answer.ReadOnly := true;
|
||||
formTappyTuxGame.GameOver.Visible := true;
|
||||
formTappyTuxGame.Yes.Visible := true;
|
||||
formTappyTuxGame.No.Visible := true;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
Reference in New Issue
Block a user