You've already forked lazarus-ccr
Adds the dancing tux animation
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2131 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
BIN
applications/tappytux/images/sprites/tux_1.png
Normal file
BIN
applications/tappytux/images/sprites/tux_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
applications/tappytux/images/sprites/tux_2.png
Normal file
BIN
applications/tappytux/images/sprites/tux_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
applications/tappytux/images/sprites/tux_3.png
Normal file
BIN
applications/tappytux/images/sprites/tux_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
applications/tappytux/images/sprites/tux_4.png
Normal file
BIN
applications/tappytux/images/sprites/tux_4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
@ -7,7 +7,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, FileUtil,
|
||||
// LCL
|
||||
ExtCtrls,
|
||||
ExtCtrls, Graphics,
|
||||
// TappyTux
|
||||
tappyconfig, tappymodules;
|
||||
|
||||
@ -27,7 +27,6 @@ type
|
||||
gameQuestionList : TStringList;
|
||||
timerWords: TTimer;
|
||||
procedure HandleOnTimer(Sender: TObject);
|
||||
|
||||
public
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
@ -60,8 +59,9 @@ begin
|
||||
Questions[i].Top:= 24;
|
||||
Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
||||
end;
|
||||
end
|
||||
end;
|
||||
|
||||
vTappyTuxDrawer.HandleAnimationOnTimer();
|
||||
end;
|
||||
|
||||
constructor TTappyWords.Create;
|
||||
@ -72,7 +72,6 @@ begin
|
||||
timerWords.Enabled := False;
|
||||
timerWords.Interval := 1000;
|
||||
timerWords.OnTimer := @HandleOnTimer;
|
||||
|
||||
end;
|
||||
|
||||
destructor TTappyWords.Destroy;
|
||||
@ -97,6 +96,7 @@ end;
|
||||
procedure TTappyWords.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer; QuestionList: Integer);
|
||||
var
|
||||
i: Integer;
|
||||
lTuxAnimation: TTappySpriteAnimation;
|
||||
begin
|
||||
timerWords.Enabled := True;
|
||||
gameScore := 0;
|
||||
@ -125,8 +125,25 @@ begin
|
||||
begin
|
||||
//Questions[i].Text := formTappyTuxGame.Test.Lines.Strings[random(71)];
|
||||
Questions[i].Text := gameQuestionList[random(gameQuestionList.Count - 1)];
|
||||
end
|
||||
end;
|
||||
|
||||
// Adds the Tux animation
|
||||
lTuxAnimation := TTappySpriteAnimation.Create;
|
||||
lTuxAnimation.IsInfinite := True;
|
||||
lTuxAnimation.StartPoint := Point(250, 300);
|
||||
lTuxAnimation.EndPoint := lTuxAnimation.StartPoint;
|
||||
SetLength(lTuxAnimation.Bitmaps, 6);
|
||||
lTuxAnimation.Bitmaps[0] := TPortableNetworkGraphic.Create;
|
||||
lTuxAnimation.Bitmaps[0].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_1.png');
|
||||
lTuxAnimation.Bitmaps[1] := TPortableNetworkGraphic.Create;
|
||||
lTuxAnimation.Bitmaps[1].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_2.png');
|
||||
lTuxAnimation.Bitmaps[2] := TPortableNetworkGraphic.Create;
|
||||
lTuxAnimation.Bitmaps[2].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_3.png');
|
||||
lTuxAnimation.Bitmaps[3] := TPortableNetworkGraphic.Create;
|
||||
lTuxAnimation.Bitmaps[3].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_4.png');
|
||||
lTuxAnimation.Bitmaps[4] := lTuxAnimation.Bitmaps[2];
|
||||
lTuxAnimation.Bitmaps[5] := lTuxAnimation.Bitmaps[1];
|
||||
vTappyTuxDrawer.AddAnimation(lTuxAnimation);
|
||||
end;
|
||||
|
||||
procedure TTappyWords.Answered;
|
||||
|
@ -28,7 +28,7 @@ type
|
||||
TTappySpriteAnimation = class(TTappyTuxAnimation)
|
||||
public
|
||||
StartPoint, EndPoint: TPoint;
|
||||
Bitmaps: array of TBitmap;
|
||||
Bitmaps: array of TFPImageBitmap;
|
||||
procedure DrawToIntfImg(AIntfImage: TLazIntfImage); override;
|
||||
procedure ExecuteFinal; override;
|
||||
end;
|
||||
@ -240,7 +240,6 @@ var
|
||||
IntfImage: TLazIntfImage;
|
||||
lDrawWidth, lDrawHeight: Integer;
|
||||
CurColor: TFPColor;
|
||||
lCurColorDiv, lTranspColorDiv: Byte;
|
||||
begin
|
||||
IntfImage := TLazIntfImage.Create(0,0);
|
||||
try
|
||||
@ -259,10 +258,10 @@ begin
|
||||
// Never draw outside the destination
|
||||
if (CurX < 0) or (CurY < 0) then Continue;
|
||||
|
||||
CurColor := IntfImage.Colors[x, y]; // Good for debugging
|
||||
lCurColorDiv := CurColor.Green div $FF;
|
||||
lTranspColorDiv := AColor.Green div $FF;
|
||||
if lCurColorDiv <> lTranspColorDiv then
|
||||
CurColor := AImage.Canvas.Colors[x, y]; // Good for debugging
|
||||
if ((CurColor.Green div $FF) <> (AColor.Green div $FF)) or
|
||||
((CurColor.Red div $FF) <> (AColor.Red div $FF)) or
|
||||
((CurColor.Blue div $FF) <> (AColor.Blue div $FF)) then
|
||||
ADest.Colors[CurX, CurY] := IntfImage.Colors[x, y];
|
||||
end;
|
||||
end;
|
||||
|
@ -91,7 +91,7 @@
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="10"/>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="tappytux"/>
|
||||
@ -102,8 +102,7 @@
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="True"/>
|
||||
<GenerateDwarf Value="True"/>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
|
Reference in New Issue
Block a user