git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2137 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
denniscuflat
2011-11-15 12:47:57 +00:00
parent c38546ca77
commit eb7fda5787
2 changed files with 46 additions and 21 deletions

View File

@ -70,6 +70,17 @@ begin
end;
end;
for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do
begin
if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then
begin
vTappyTuxDrawer.GetAnimation(i).StartPoint.y:= vTappyTuxDrawer.GetAnimation(i).StartPoint.y + (5*gameLevel);
vTappyTuxDrawer.GetAnimation(i).EndPoint.y:= vTappyTuxDrawer.GetAnimation(i).StartPoint.y;
end;
end;
vTappyTuxDrawer.HandleAnimationOnTimer();
end;
@ -106,6 +117,7 @@ procedure TTappyWords.StartNewGame(SndFX: Integer; Music: Integer; Level: Intege
var
i: Integer;
lTuxAnimation: TTappySpriteAnimation;
begin
timerWords.Enabled := True;
gameScore := 0;
@ -118,10 +130,11 @@ begin
if (Music = 1) then gameMusic := false;
gameSLevel := gameLevel;
if QuestionList < 0 then QuestionList := 0;
gameQuestionList := TStringList.Create;
//gameQuestionList.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images'+PathDelim+'modules'+PathDelim+'tappywords'+PathDelim+'0.txt');
//gameQuestionList.LoadFromFile('C:/Users/User/Lazarus/Arquivos/Repositorio/applications/tappytux/images/modules/tappywords/0.txt');
//gameQuestionList.LoadFromFile('C:/0.txt');
gameQuestionList.LoadFromFile('C:/'+IntToStr(QuestionList)+'.txt');
formTappyTuxGame.Answer.ReadOnly := false;
formTappyTuxGame.GameOver.Visible := false;
@ -133,14 +146,14 @@ begin
for i:= 1 to 5 do
begin
Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
//Questions[i].Text := gameQuestionList[random(gameQuestionList.Count - 1)];
//Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
Questions[i].Text := gameQuestionList[random(gameQuestionList.Count - 1)];
end;
// Animations Creation
lTuxAnimation := TTappySpriteAnimation.Create;
lTuxAnimation.IsInfinite := True;
lTuxAnimation.StartPoint := Point(250, 300);
lTuxAnimation.StartPoint := Point(250, 328);
lTuxAnimation.EndPoint := lTuxAnimation.StartPoint;
SetLength(lTuxAnimation.Bitmaps, 6);
lTuxAnimation.Bitmaps[0] := TPortableNetworkGraphic.Create;
@ -181,6 +194,8 @@ begin
snowmanAnimation := TFallingText.Create;
snowmanAnimation.IsInfinite := True;
if True then
begin
for i:= 0 to vTappyTuxDrawer.GetAnimationCount - 1 do
begin
if vTappyTuxDrawer.GetAnimation(i).InheritsFrom(TFallingText) then
@ -197,6 +212,7 @@ begin
end;
end;
end;
end;
if existenceAux1 = false then xAux := 5
else
@ -219,6 +235,7 @@ begin
snowmanAnimation.StartPoint := Point(xAux, 5);
snowmanAnimation.EndPoint := snowmanAnimation.StartPoint;
snowmanAnimation.Bitmap := TPortableNetworkGraphic.Create;
snowmanAnimation.QuestionText:= formTappyTuxGame.Test.Lines.Strings[random(71)];
snowmanAnimation.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowman.png');
vTappyTuxDrawer.AddAnimation(snowmanAnimation);
@ -233,7 +250,8 @@ begin
if (formTappyTuxGame.Answer.Text = Questions[i].Text) then
begin
Questions[i].Top := 24;
Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
//Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
Questions[i].Text := gameQuestionList[random(gameQuestionList.Count - 1)];
gameScore := gameScore +1;
gameLevel := (gameScore div 20) + gameSLevel;
formTappyTuxGame.Score.Text := IntToStr(gameScore);
@ -245,6 +263,7 @@ end;
procedure TTappyWords.EndGame;
var
i : Integer;
gameOverScreen: TTappySpriteAnimation;
continueBtn: TButton;
exitBtn: TButton;
@ -261,6 +280,11 @@ begin
//gameOverScreen.Bitmaps[0].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'gameover.png');
//vTappyTuxDrawer.AddAnimation(gameOverScreen);
for i:= 1 to vTappyTuxDrawer.GetAnimationCount - 1 do
begin
vTappyTuxDrawer.GetAnimation(i).Destroy;
end;
formTappyTuxGame.GameOver.Visible := true;
formTappyTuxGame.Yes.Visible := true;
formTappyTuxGame.No.Visible := true;

View File

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, Controls, Graphics, LCLType, IntfGraphics, fpimage,
Math,
{tappygamedata,} tappyconfig, tappymodules;
tappyconfig, tappymodules;
type
@ -48,7 +48,8 @@ type
public
//StartPoint, EndPoint: TPoint; override;
Bitmap: TFPImageBitmap;
Question: TCanvas;
QuestionText: String;
QuestionBox: TCanvas;
procedure DrawToIntfImg(AIntfImage: TLazIntfImage); override;
procedure ExecuteFinal; override;
end;
@ -146,6 +147,8 @@ begin
TTappyTuxDrawer.DrawImageWithTransparentColor(AIntfImage,
lPos.X, lPos.Y, colFuchsia, Bitmap);
QuestionBox := TCanvas.Create;
QuestionBox.TextOut(lPos.X, lPos.Y, QuestionText);
end;
procedure TFallingText.ExecuteFinal;
@ -365,8 +368,6 @@ begin
begin
lAnimation := TTappyTuxAnimation(FAnimationList.Items[i]);
Inc(lAnimation.CurrentStep);
if lAnimation.InheritsFrom(TFallingText) then lAnimation.StartPoint.y := lAnimation.StartPoint.y + 10;
end;
Self.Invalidate;