TappyTux is fully playable. Sound yet to be implemented.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2147 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
denniscuflat
2011-11-16 00:43:34 +00:00
parent f9df1c361b
commit d07426651b
6 changed files with 158 additions and 113 deletions

View File

@ -8,6 +8,7 @@ object formConfig: TformConfig
ClientWidth = 582
OnClick = btnLoadClick
OnCreate = FormCreate
Position = poDesktopCenter
LCLVersion = '0.9.31'
Visible = True
object comboGameType: TComboBox
@ -150,22 +151,48 @@ object formConfig: TformConfig
Height = 173
Top = 189
Width = 153
Font.Height = -9
Lines.Strings = (
'Função 1:'
' Nome 1.1'
'TappyTux 3.0 (2011)'
''
'Função 2:'
' Nome 2.1'
' Nome 2.2'
'Felipe Monteiro de Carvalho'
'Dennis T. S. C.'
'Ana Claudia M. V.'
'Felipe M. K. M.'
'Guilherme Henrique S. S.'
''
'Função 3:'
' Nome 3.1'
' Nome 3.2'
' Nome 3.3'
''
'Função 4:'
' Nome 4.1'
'TappyTux 2.2 (2004)'
''
'Chief Software Architect'
' A.J. Venter'
' (aj@getopenlab.com)'
''
'Artwork'
' Silvia Hirano'
' Karl Fischer'
' A.J. Venter'
''
'Additional Artwork'
' The supertux project'
''
'Sound Effects'
' The KDE project'
''
'Music'
' DK Miller'
''
'Design & Quality Control'
' D.G. Brandjes'
''
'This program is free '
'software under the '
'GNU GPL'
'http://www.gnu.org'
''
)
OnChange = memoCreditsChange
ParentFont = False
ReadOnly = True
ScrollBars = ssAutoVertical
TabOrder = 6

View File

@ -35,6 +35,7 @@ type
procedure btnLoadClick(Sender: TObject);
procedure comboGameTypeChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure memoCreditsChange(Sender: TObject);
private
{ private declarations }
public
@ -80,6 +81,11 @@ begin
GetModule(i).InitModule();
end;
procedure TformConfig.memoCreditsChange(Sender: TObject);
begin
end;
procedure TformConfig.TranslateUI;
var
i: Integer;

View File

@ -8,6 +8,7 @@ object formTappyTuxGame: TformTappyTuxGame
ClientWidth = 621
OnCreate = FormCreate
OnShow = FormShow
Position = poDesktopCenter
LCLVersion = '0.9.31'
object btnExit: TButton
Left = 8
@ -104,88 +105,6 @@ object formTappyTuxGame: TformTappyTuxGame
ReadOnly = True
TabOrder = 4
end
object Test: TMemo
Left = 480
Height = 181
Top = 200
Width = 130
Lines.Strings = (
'cachorro'
'gato'
'peixe'
'pássaro'
'macaco'
'leão'
'tigre'
'elefante'
'crocodilo'
'abelha'
'mosca'
'água-viva'
'tartaruga'
'lagartixa'
'sapo'
'minhoca'
'centopéia'
'rinoceronte'
'coiote'
'águia'
'canguru'
'coala'
'morcego'
'gavião'
'pavão'
'cobra'
'camelo'
'lontra'
'tubarão'
'coelho'
'baleia'
'urso'
'foca'
'escorpião'
'touro'
'vaca'
'galinha'
'formiga'
'borboleta'
'girafa'
'arara'
'salamandra'
'rã'
'pinguim'
'tatu'
'avestruz'
'hiena'
'pelicano'
'pombo'
'orangotango'
'coruja'
'papagaio'
'tucano'
'ornitorrinco'
'gambá'
'rato'
'esquilo'
'golfinho'
'ovelha'
'morsa'
'suricato'
'ornitorrinco'
'toupeira'
'barata'
'lula'
'polvo'
'tamanduá'
'camarão'
'lêmure'
'besouro'
'onça'
)
OnChange = TestChange
TabOrder = 5
Visible = False
end
object GameOver: TToggleBox
Left = 240
Height = 64
@ -196,7 +115,7 @@ object formTappyTuxGame: TformTappyTuxGame
Color = clRed
Enabled = False
State = cbChecked
TabOrder = 6
TabOrder = 5
Visible = False
end
object Yes: TButton
@ -207,7 +126,7 @@ object formTappyTuxGame: TformTappyTuxGame
Caption = 'Yes'
Color = clRed
OnClick = YesClick
TabOrder = 7
TabOrder = 6
Visible = False
end
object No: TButton
@ -218,7 +137,7 @@ object formTappyTuxGame: TformTappyTuxGame
Caption = 'No'
Color = clRed
OnClick = NoClick
TabOrder = 8
TabOrder = 7
Visible = False
end
end

View File

@ -26,7 +26,6 @@ type
LabelLevels: TLabel;
LabelScore: TLabel;
LabelLives: TLabel;
Test: TMemo;
GameOver: TToggleBox;
procedure btnExitClick(Sender: TObject);
procedure AnswerKeyPress(Sender: TObject; var Key: char);
@ -66,7 +65,6 @@ procedure TformTappyTuxGame.AnswerKeyPress(Sender: TObject; var Key: char);
begin
if Key = #13 then
begin
formTappyTuxGame.Test.Lines.Add(Answer.Text);
GetCurrentModule().Answered();
formTappyTuxGame.Answer.Clear;

View File

@ -53,6 +53,8 @@ var
i: Integer;
j: Integer;
frequency: Integer;
snowmanWrong: TFallingText;
begin
i:= 0;
j:= vTappyTuxDrawer.GetAnimationCount - 1;
@ -60,21 +62,56 @@ begin
begin
if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then
begin
if (vTappyTuxDrawer.GetAnimation(i).Position.y >= 270) then
if (vTappyTuxDrawer.GetAnimation(i).Caption = 'OK!') then
begin
if (vTappyTuxDrawer.GetAnimation(i).Value = '1') then
begin
vTappyTuxDrawer.RemoveAnimation(i);
i := i - 1;
end;
if (vTappyTuxDrawer.GetAnimation(i).Value = '0') then vTappyTuxDrawer.GetAnimation(i).Value := '1';
end;
if (vTappyTuxDrawer.GetAnimation(i).Caption = 'Oh-oh!') then
begin
vTappyTuxDrawer.RemoveAnimation(i);
gameLives := gameLives - 1;
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
vTappyTuxDrawer.RemoveAnimation(i);
CreateQuestion();
if gameLives <= 0 then EndGame();
i := i - 1;
if (gameLives = 0) then EndGame();
CreateQuestion;
end;
end;
i := i + 1;
j := vTappyTuxDrawer.GetAnimationCount - 1;
end;
frequency := 30;
i:= 0;
j:= vTappyTuxDrawer.GetAnimationCount - 1;
while (i<= j) do
begin
if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then
begin
if ((vTappyTuxDrawer.GetAnimation(i).Position.y >= 270) AND (vTappyTuxDrawer.GetAnimation(i).Caption <> 'Oh-oh!')) then
begin
snowmanWrong := TFallingText.Create;
snowmanWrong.IsInfinite := False;
snowmanWrong.StartPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.EndPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.Position := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.Bitmap := TPortableNetworkGraphic.Create;
snowmanWrong.caption:= 'Oh-oh!';
snowmanWrong.value:= '0';
snowmanWrong.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanwrong.png');
vTappyTuxDrawer.AddAnimation(snowmanWrong);
vTappyTuxDrawer.RemoveAnimation(i);
i := i -1;
end;
end;
i := i + 1;
j := vTappyTuxDrawer.GetAnimationCount - 1;
end;
frequency := 60;
count := count + 1;
if count >= frequency then
begin
@ -123,6 +160,7 @@ var
begin
count := 0;
timerMath.Enabled := True;
timerMath.Interval:= 500;
gameScore := 0;
gameLives := 5;
gameLevel := Level+1;
@ -188,7 +226,6 @@ begin
yAux:=5;
snowmanAnimation := TFallingText.Create;
snowmanAnimation.IsInfinite := False;
for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do
@ -235,7 +272,7 @@ begin
end;
snowmanAnimation.StartPoint := Point(xAux, 5);
snowmanAnimation.EndPoint := Point(xAux, 205);
snowmanAnimation.EndPoint := Point(xAux, 100);
snowmanAnimation.IsInfinite:= false;
snowmanAnimation.Bitmap := TPortableNetworkGraphic.Create;
//snowmanAnimation.caption:= gameQuestionList[random(gameQuestionList.Count - 1)];
@ -275,6 +312,8 @@ procedure TTappyMath.Answered;
var
i: Integer;
j: Integer;
snowmanRight: TFallingText;
begin
i:= 0;
j:= vTappyTuxDrawer.GetAnimationCount - 1;
@ -288,6 +327,16 @@ begin
gameLevel := (gameScore div 20) + gameSLevel;
formTappyTuxGame.Score.Text := IntToStr(gameScore);
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
snowmanRight := TFallingText.Create;
snowmanRight.IsInfinite := False;
snowmanRight.StartPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.EndPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.Position := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.Bitmap := TPortableNetworkGraphic.Create;
snowmanRight.caption:= 'OK!';
snowmanRight.value:= '0';
snowmanRight.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanright.png');
vTappyTuxDrawer.AddAnimation(snowmanRight);
vTappyTuxDrawer.RemoveAnimation(i);
i := i - 1;
CreateQuestion;

View File

@ -55,6 +55,7 @@ var
i: Integer;
j: Integer;
frequency: Integer;
snowmanWrong: TFallingText;
begin
i:= 0;
j:= vTappyTuxDrawer.GetAnimationCount - 1;
@ -62,21 +63,56 @@ begin
begin
if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then
begin
if (vTappyTuxDrawer.GetAnimation(i).Position.y >= 270) then
if (vTappyTuxDrawer.GetAnimation(i).Caption = 'OK!') then
begin
if (vTappyTuxDrawer.GetAnimation(i).Value = '1') then
begin
vTappyTuxDrawer.RemoveAnimation(i);
i := i - 1;
end;
if (vTappyTuxDrawer.GetAnimation(i).Value = '0') then vTappyTuxDrawer.GetAnimation(i).Value := '1';
end;
if (vTappyTuxDrawer.GetAnimation(i).Caption = 'Oh-oh!') then
begin
vTappyTuxDrawer.RemoveAnimation(i);
gameLives := gameLives - 1;
formTappyTuxGame.Lives.Text := IntToStr(gameLives);
vTappyTuxDrawer.RemoveAnimation(i);
CreateQuestion();
if gameLives <= 0 then EndGame();
i := i - 1;
if (gameLives = 0) then EndGame();
CreateQuestion;
end;
end;
i := i + 1;
j := vTappyTuxDrawer.GetAnimationCount - 1;
end;
frequency := 30;
i:= 0;
j:= vTappyTuxDrawer.GetAnimationCount - 1;
while (i<= j) do
begin
if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then
begin
if ((vTappyTuxDrawer.GetAnimation(i).Position.y >= 270) AND (vTappyTuxDrawer.GetAnimation(i).Caption <> 'Oh-oh!')) then
begin
snowmanWrong := TFallingText.Create;
snowmanWrong.IsInfinite := False;
snowmanWrong.StartPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.EndPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.Position := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.Bitmap := TPortableNetworkGraphic.Create;
snowmanWrong.caption:= 'Oh-oh!';
snowmanWrong.value:= '0';
snowmanWrong.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanwrong.png');
vTappyTuxDrawer.AddAnimation(snowmanWrong);
vTappyTuxDrawer.RemoveAnimation(i);
i := i -1;
end;
end;
i := i + 1;
j := vTappyTuxDrawer.GetAnimationCount - 1;
end;
frequency := 60;
count := count + 1;
if count >= frequency then
begin
@ -125,6 +161,7 @@ var
begin
count := 5;
timerWords.Enabled := True;
timerWords.Interval:= 500;
gameScore := 0;
gameLives := 5;
gameLevel := Level+1;
@ -203,7 +240,6 @@ begin
yAux:=5;
snowmanAnimation := TFallingText.Create;
snowmanAnimation.IsInfinite := False;
for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do
@ -250,7 +286,7 @@ begin
end;
snowmanAnimation.StartPoint := Point(xAux, 5);
snowmanAnimation.EndPoint := Point(xAux, 205);
snowmanAnimation.EndPoint := Point(xAux, 100);
snowmanAnimation.IsInfinite:= false;
snowmanAnimation.Bitmap := TPortableNetworkGraphic.Create;
snowmanAnimation.caption:= gameQuestionList[random(gameQuestionList.Count - 1)];
@ -263,6 +299,7 @@ procedure TTappyWords.Answered;
var
i: Integer;
j: Integer;
snowmanRight: TFallingText;
begin
i:= 0;
@ -273,11 +310,20 @@ begin
begin
if (vTappyTuxDrawer.GetAnimation(i).caption = formTappyTuxGame.Answer.Text) then
begin
(vTappyTuxDrawer.GetAnimation(i) as TFallingText).Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanhit.png');
gameScore := gameScore +1;
gameLevel := (gameScore div 20) + gameSLevel;
formTappyTuxGame.Score.Text := IntToStr(gameScore);
formTappyTuxGame.Level.Text := IntToStr(gameLevel);
snowmanRight := TFallingText.Create;
snowmanRight.IsInfinite := False;
snowmanRight.StartPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.EndPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.Position := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.Bitmap := TPortableNetworkGraphic.Create;
snowmanRight.caption:= 'OK!';
snowmanRight.value:= '0';
snowmanRight.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanright.png');
vTappyTuxDrawer.AddAnimation(snowmanRight);
vTappyTuxDrawer.RemoveAnimation(i);
i := i - 1;
end;