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);
begin
SetCurrentModule(comboGameType.ItemIndex);
GetCurrentModule().StartNewGame(comboSound.ItemIndex, comboMusic.ItemIndex, comboLevel.ItemIndex);
formTappyTuxGame.Show;
GetCurrentModule().StartNewGame(comboSound.ItemIndex, comboMusic.ItemIndex, comboLevel.ItemIndex);
Hide;
end;

View File

@ -1,7 +1,7 @@
object formTappyTuxGame: TformTappyTuxGame
Left = 630
Left = 388
Height = 425
Top = 245
Top = 200
Width = 621
Caption = 'Tappy Tux'
ClientHeight = 425
@ -17,15 +17,15 @@ object formTappyTuxGame: TformTappyTuxGame
OnClick = btnExitClick
TabOrder = 0
end
object Edit1: TEdit
object Answer: TEdit
Left = 104
Height = 23
Top = 392
Width = 514
OnKeyPress = Edit1KeyPress
OnKeyPress = AnswerKeyPress
TabOrder = 1
end
object Label1: TLabel
object LabelLevels: TLabel
Left = 8
Height = 39
Top = 24
@ -43,7 +43,7 @@ object formTappyTuxGame: TformTappyTuxGame
ParentFont = False
Transparent = False
end
object Label2: TLabel
object LabelScore: TLabel
Left = 8
Height = 39
Top = 112
@ -61,7 +61,7 @@ object formTappyTuxGame: TformTappyTuxGame
ParentFont = False
Transparent = False
end
object Label3: TLabel
object LabelLives: TLabel
Left = 9
Height = 39
Top = 192
@ -79,7 +79,7 @@ object formTappyTuxGame: TformTappyTuxGame
ParentFont = False
Transparent = False
end
object Edit2: TEdit
object Level: TEdit
Left = 8
Height = 23
Top = 64
@ -87,7 +87,7 @@ object formTappyTuxGame: TformTappyTuxGame
ReadOnly = True
TabOrder = 2
end
object Edit3: TEdit
object Score: TEdit
Left = 8
Height = 23
Top = 152
@ -95,7 +95,7 @@ object formTappyTuxGame: TformTappyTuxGame
ReadOnly = True
TabOrder = 3
end
object Edit4: TEdit
object Lives: TEdit
Left = 8
Height = 23
Top = 232
@ -103,10 +103,10 @@ object formTappyTuxGame: TformTappyTuxGame
ReadOnly = True
TabOrder = 4
end
object Memo1: TMemo
Left = 383
object Test: TMemo
Left = 480
Height = 181
Top = 76
Top = 24
Width = 130
Lines.Strings = (
'[TESTE]'
@ -114,5 +114,51 @@ object formTappyTuxGame: TformTappyTuxGame
''
)
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

View File

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

View File

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

View File

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