-
Notifications
You must be signed in to change notification settings - Fork 6
/
uBonus.pas
52 lines (43 loc) · 1.01 KB
/
uBonus.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
unit uBonus;
interface
uses
Types, UITypes, FMX.Types, FMX.Graphics, System.UIConsts, system.Generics.Collections, FMX.Ani, FMX.Objects,
System.Classes, uConsts;
type
TTypeBonus = (points, doubleTir);
TBonus = class(TImage)
private
fSpeedX : single;
fValeur : integer;
fTypeBonus : TTypeBonus;
public
constructor Create(AOwner: TComponent);
destructor Destroy; override;
procedure Update;
property VitesseX : single read fSpeedX write fSpeedX;
property Valeur : integer read fValeur write fValeur;
property TypeBonus : TTypeBonus read fTypeBonus write fTypeBonus;
end;
implementation
{ TBonus }
constructor TBonus.Create(AOwner: TComponent);
begin
inherited;
height := 18;
width := 110;
VitesseX := 3 + random(8);
Valeur := 1000;
TypeBonus := TTypeBonus.points;
end;
destructor TBonus.Destroy;
begin
inherited;
end;
procedure TBonus.Update;
begin
Position.X := Position.X - VitesseX;
if Position.X < -width then begin
visible := false;
end;
end;
end.