forked from ForzaMark/DelphiProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit1.pas
More file actions
125 lines (84 loc) · 2.93 KB
/
Unit1.pas
File metadata and controls
125 lines (84 loc) · 2.93 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TBot,TSpielfigur,TKarte, ExtCtrls, StdCtrls,uTFightSystem,uTPokemon,pngimage;
//pngimage kommt von Vorlagen/Informatik/ga-if/12/BeispielPNG ... Zu genaueren Quellen
//Herr Markert fragen
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
//procedure Timer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
var Karte : TKarte1;
var Spielfigur : TSpielfigur1;
var Bot : TBot1;
var Kampf : TFightSystem;
var Pokemon1,Pokemon2 : TPokemon;
procedure TForm1.FormCreate(Sender: TObject);
begin
Karte := TKarte1.Create(Form1,0,0);
Karte.paintbackground('newback.bmp');
Spielfigur := TSpielfigur1.Create(Form1,50,50);
Bot := TBot1.Create(Form1,375,115) ;
Bot.setFightDistanceX(0);
Bot.setFightDistanceY(21);
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (key = 'a') and Karte.prooveCoords(Karte.getPosX + 5,Karte.getPosY) then
begin
Karte.setPosX(5);
Spielfigur.paintFigur(1);
Bot.setPosX(5);
Bot.setDistanceX(Spielfigur.getLeft);
Bot.setDistanceY(Spielfigur.getTop());
end;
if (key = 'd') and Karte.prooveCoords(Karte.getPosX - 5,Karte.getPosY) then
begin
Karte.setPosX(-5);
Spielfigur.paintFigur(2);
Bot.setPosX(-5);
Bot.setDistanceX(Spielfigur.getLeft);
Bot.setDistanceY(Spielfigur.getTop());
end;
if (key = 's') and Karte.prooveCoords(Karte.getPosX ,Karte.getPosY - 5) then
begin
Karte.setPosY(-5);
Spielfigur.paintFigur(4);
Bot.setPosY(-5);
Bot.setDistanceX(Spielfigur.getLeft);
Bot.setDistanceY(Spielfigur.getTop());
end;
if (key = 'w') and Karte.prooveCoords(Karte.getPosX ,Karte.getPosY + 5) then
begin
Karte.setPosY(5);
Spielfigur.paintFigur(3);
Bot.setPosY(5);
Bot.setDistanceX(Spielfigur.getLeft);
Bot.setDistanceY(Spielfigur.getTop());
end;
if (Key = 'x') and (Karte.getPosX = -365) and (Karte.getPosY = -50) then ShowMessage('Schild');
if (Key = 'x') and (abs(Bot.getDistanceY()) <= abs(Bot.getFightDistanceY())) and (abs(Bot.getDistanceX()) <= abs(Bot.getFightDistanceX())) then
begin
ShowMessage(Bot.startConversation());
Kampf := TFightSystem.Create(Form1,0,0);
Pokemon1 := TPokemon.create(Form1,1,3);
Pokemon2 := TPokemon.create(Form1,2,1);
Pokemon1.drawPokemon(Form1,130,10);
Pokemon2.drawPokemon(Form1,20,100);
Form1.ClientHeight:= 230;
Form1.ClientWidth:= 250;
end;
end;
end.