tappygamedata.pas is being rewritten.

TappyWords is already playable, but in a very rudimentary way.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2090 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
denniscuflat
2011-10-24 23:09:39 +00:00
parent bd690c6ad9
commit d7827921fc
5 changed files with 105 additions and 39 deletions

View File

@ -77,8 +77,8 @@ end;
procedure TformConfig.btnLoadClick(Sender: TObject); procedure TformConfig.btnLoadClick(Sender: TObject);
begin begin
SetCurrentModule(comboGameType.ItemIndex); SetCurrentModule(comboGameType.ItemIndex);
GetCurrentModule().StartNewGame(comboSound.ItemIndex, comboMusic.ItemIndex, comboLevel.ItemIndex);
formTappyTuxGame.Show; formTappyTuxGame.Show;
GetCurrentModule().StartNewGame(comboSound.ItemIndex, comboMusic.ItemIndex, comboLevel.ItemIndex);
Hide; Hide;
end; end;

View File

@ -1,7 +1,7 @@
object formTappyTuxGame: TformTappyTuxGame object formTappyTuxGame: TformTappyTuxGame
Left = 630 Left = 388
Height = 425 Height = 425
Top = 245 Top = 200
Width = 621 Width = 621
Caption = 'Tappy Tux' Caption = 'Tappy Tux'
ClientHeight = 425 ClientHeight = 425
@ -17,15 +17,15 @@ object formTappyTuxGame: TformTappyTuxGame
OnClick = btnExitClick OnClick = btnExitClick
TabOrder = 0 TabOrder = 0
end end
object Edit1: TEdit object Answer: TEdit
Left = 104 Left = 104
Height = 23 Height = 23
Top = 392 Top = 392
Width = 514 Width = 514
OnKeyPress = Edit1KeyPress OnKeyPress = AnswerKeyPress
TabOrder = 1 TabOrder = 1
end end
object Label1: TLabel object LabelLevels: TLabel
Left = 8 Left = 8
Height = 39 Height = 39
Top = 24 Top = 24
@ -43,7 +43,7 @@ object formTappyTuxGame: TformTappyTuxGame
ParentFont = False ParentFont = False
Transparent = False Transparent = False
end end
object Label2: TLabel object LabelScore: TLabel
Left = 8 Left = 8
Height = 39 Height = 39
Top = 112 Top = 112
@ -61,7 +61,7 @@ object formTappyTuxGame: TformTappyTuxGame
ParentFont = False ParentFont = False
Transparent = False Transparent = False
end end
object Label3: TLabel object LabelLives: TLabel
Left = 9 Left = 9
Height = 39 Height = 39
Top = 192 Top = 192
@ -79,7 +79,7 @@ object formTappyTuxGame: TformTappyTuxGame
ParentFont = False ParentFont = False
Transparent = False Transparent = False
end end
object Edit2: TEdit object Level: TEdit
Left = 8 Left = 8
Height = 23 Height = 23
Top = 64 Top = 64
@ -87,7 +87,7 @@ object formTappyTuxGame: TformTappyTuxGame
ReadOnly = True ReadOnly = True
TabOrder = 2 TabOrder = 2
end end
object Edit3: TEdit object Score: TEdit
Left = 8 Left = 8
Height = 23 Height = 23
Top = 152 Top = 152
@ -95,7 +95,7 @@ object formTappyTuxGame: TformTappyTuxGame
ReadOnly = True ReadOnly = True
TabOrder = 3 TabOrder = 3
end end
object Edit4: TEdit object Lives: TEdit
Left = 8 Left = 8
Height = 23 Height = 23
Top = 232 Top = 232
@ -103,10 +103,10 @@ object formTappyTuxGame: TformTappyTuxGame
ReadOnly = True ReadOnly = True
TabOrder = 4 TabOrder = 4
end end
object Memo1: TMemo object Test: TMemo
Left = 383 Left = 480
Height = 181 Height = 181
Top = 76 Top = 24
Width = 130 Width = 130
Lines.Strings = ( Lines.Strings = (
'[TESTE]' '[TESTE]'
@ -114,5 +114,51 @@ object formTappyTuxGame: TformTappyTuxGame
'' ''
) )
TabOrder = 5 TabOrder = 5
Visible = False
end
object Question1: TEdit
Left = 120
Height = 23
Top = 216
Width = 82
ReadOnly = True
TabOrder = 6
Text = 'Melancia'
end
object Question2: TEdit
Left = 224
Height = 23
Top = 216
Width = 80
ReadOnly = True
TabOrder = 7
Text = 'Abacate'
end
object Question4: TEdit
Left = 320
Height = 23
Top = 216
Width = 80
ReadOnly = True
TabOrder = 8
Text = 'Cereja'
end
object Question3: TEdit
Left = 416
Height = 23
Top = 216
Width = 80
ReadOnly = True
TabOrder = 9
Text = 'Melão'
end
object Question5: TEdit
Left = 512
Height = 23
Top = 216
Width = 80
ReadOnly = True
TabOrder = 10
Text = 'Laranja'
end end
end end

View File

@ -16,17 +16,23 @@ type
TformTappyTuxGame = class(TForm) TformTappyTuxGame = class(TForm)
btnExit: TButton; btnExit: TButton;
Edit1: TEdit; Answer: TEdit;
Edit2: TEdit; Question2: TEdit;
Edit3: TEdit; Question4: TEdit;
Edit4: TEdit; Question3: TEdit;
Label1: TLabel; Question5: TEdit;
Label2: TLabel; Level: TEdit;
Label3: TLabel; Score: TEdit;
Memo1: TMemo; Lives: TEdit;
Question1: TEdit;
LabelLevels: TLabel;
LabelScore: TLabel;
LabelLives: TLabel;
Test: TMemo;
procedure btnExitClick(Sender: TObject); procedure btnExitClick(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: char); procedure AnswerKeyPress(Sender: TObject; var Key: char);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
private private
{ private declarations } { private declarations }
public public
@ -39,7 +45,7 @@ var
implementation implementation
uses gameconfigform; uses gameconfigform, mod_tappywords;
{$R *.lfm} {$R *.lfm}
@ -53,12 +59,19 @@ begin
GetCurrentModule().EndGame(); GetCurrentModule().EndGame();
end; end;
procedure TformTappyTuxGame.Edit1KeyPress(Sender: TObject; var Key: char); procedure TformTappyTuxGame.AnswerKeyPress(Sender: TObject; var Key: char);
begin begin
if Key = #13 then if Key = #13 then
begin begin
formTappyTuxGame.Memo1.Lines.Add(Edit1.Text); formTappyTuxGame.Test.Lines.Add(Answer.Text);
formTappyTuxGame.Edit1.Clear;
if (Answer.Text = Question1.Text) then Question1.Top := 50;
if (Answer.Text = Question2.Text) then Question2.Top := 50;
if (Answer.Text = Question3.Text) then Question3.Top := 50;
if (Answer.Text = Question4.Text) then Question4.Top := 50;
if (Answer.Text = Question5.Text) then Question5.Top := 50;
formTappyTuxGame.Answer.Clear;
//TappyTuxGame.ThrowHammer(); //TappyTuxGame.ThrowHammer();
end; end;
@ -76,6 +89,7 @@ begin
vTappyTuxDrawer.SendToBack(); vTappyTuxDrawer.SendToBack();
end; end;
{procedure TformTappyTuxGame.OnClose; {procedure TformTappyTuxGame.OnClose;
begin begin
formConfig formConfig

View File

@ -18,6 +18,7 @@ type
TTappyWords = class(TTappyModule) TTappyWords = class(TTappyModule)
private private
timerWords: TTimer; timerWords: TTimer;
newGame : TTappyGameData;
procedure HandleOnTimer(Sender: TObject); procedure HandleOnTimer(Sender: TObject);
public public
constructor Create; override; constructor Create; override;
@ -30,16 +31,21 @@ type
implementation implementation
uses tappydrawer; uses tappydrawer, gameplayform;
{ TTappyWords } { TTappyWords }
procedure TTappyWords.HandleOnTimer(Sender: TObject); procedure TTappyWords.HandleOnTimer(Sender: TObject);
begin begin
vTappyTuxDrawer.HandleAnimationOnTimer(); //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;
// Create falling ballons here // Create falling ballons here
vTappyTuxDrawer.AddAnimation(TBallonAnimation.Create); //vTappyTuxDrawer.AddAnimation(TBallonAnimation.Create);
end; end;
constructor TTappyWords.Create; constructor TTappyWords.Create;
@ -74,15 +80,15 @@ procedure TTappyWords.StartNewGame(SndFX: Integer; Music: Integer; Level: Intege
begin begin
//Causam "External: SIGSEGV" //Causam "External: SIGSEGV"
gameData.SetSndFX(SndFX); //gameData.SetSndFX(SndFX);
gameData.SetMusic(Music); //gameData.SetMusic(Music);
gameData.SetLevel(Level); //gameData.SetLevel(Level);
timerWords.Enabled := True; timerWords.Enabled := True;
//formTappyTuxGame.Question1.Top:= formTappyTuxGame.Question1.Top + timerWords.ComponentCount ;
end;
end;
procedure TTappyWords.EndGame; procedure TTappyWords.EndGame;
begin begin

View File

@ -33,16 +33,16 @@ implementation
procedure TTappyGameData.SetSndFX(var newSndFX: Integer); procedure TTappyGameData.SetSndFX(var newSndFX: Integer);
begin begin
Case newSndFx of Case newSndFx of
0: gameData.SndFX := true; 0: SndFX := true;
1: gameData.SndFX := false; 1: SndFX := false;
end; end;
end; end;
procedure TTappyGameData.SetMusic(var newMusic: Integer); procedure TTappyGameData.SetMusic(var newMusic: Integer);
begin begin
Case newMusic of Case newMusic of
0: gameData.Music := true; 0: Music := true;
1: gameData.Music := false; 1: Music := false;
end; end;
end; end;