Autor Beitrag
DelphiProgrammer97
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62



BeitragVerfasst: So 20.12.09 17:03 
Hallo

Ich habe vor ca. 1 Monat angefangen zu programmieren, ich habe jetzt informatik, da ich in die 7. Klasse gehe. Da habe ich dann mitbekomen dass es eine AG Programmiersprachen gibt

Da bin ich dann eben hingegangen und mir machts Spaß

programmieren tue ich alles momentan mit Delphi 6, was ich von meinem Lehrer bekommen habe

Nachdem ich etwas mit Variablen und der Visible Funktion experimentiert habe, möchte ich euch ein kleines Spiel vorstellen, was von mir stammt: Zielscheiben - Schießen nenne ich es
Das Programm ist nur schlappe 400Kb groß und einfach zu bedienen.
Also viel spaß(mehr oder weniger, ich bin noch kein spieleentwickler).

Moderiert von user profile iconNarses: Programm als Anhang hochgeladen.
Moderiert von user profile iconNarses: Topic aus Open Source Units verschoben am So 20.12.2009 um 23:09
Moderiert von user profile iconNarses: Topic aus Open Source Projekte verschoben am Mo 21.03.2011 um 17:50
Einloggen, um Attachments anzusehen!
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 20.12.09 17:16 
Hallo und :welcome:

Unter Open Source Units bist du ja etwas in der falschen Sparte gelandet, denn erstens ist es ein Programm und zweitens ohne Quelltext. ;-)
Du kannst die Datei auch einfach mittels "Dateianhang hinzufügen" unter dem Eingabefeld hier im Forum anhängen.

Zum Programm selbst:
Das funktioniert soweit gut, aber ist das so gewollt, dass keine Meldung oder ähnliches kommt, wenn man fertig ist?

Und ein Tipp: Wie wäre es, wenn du bei Klicks mit dem Satz des Pythagoras schaust, ob man wirklich in den Kreis geklickt hat und nicht in eine Ecke des Quadrats? ;-)
DelphiProgrammer97 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62



BeitragVerfasst: So 20.12.09 17:25 
oh entschuldigung für den falschen ort


naja es ist bereits ca 1 woche her dass ich das programm fertig habe

ich arbeite gerade daran dass eine messagebox deine zeit anzeigt, wenn du fertig bist

Quelltext:

ausblenden volle Höhe Delphi-Quelltext
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:
var
  Form1: TForm1;
  zeit1 : integer;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('Schieß so schnell wie möglich die Zielscheiben ab! Viel Spaß!');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Button1.Visible:=False;
  Button2.Visible:=False;
  Button3.Visible:=True;
  Button4.Visible:=True;

  Shape1.Visible:=True;
  Shape2.Visible:=True;
  Shape3.Visible:=True;
  Shape4.Visible:=True;
  Shape5.Visible:=True;
  Shape6.Visible:=True;
  Shape7.Visible:=True;
  timer1.Enabled:=true;
  zeit1:=0;

end;

procedure TForm1.Shape1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Shape1.Visible:=False;
end;

procedure TForm1.Shape2MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Shape2.Visible:=False;
end;

procedure TForm1.Shape5MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Shape5.Visible:=False;
end;

procedure TForm1.Shape3MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Shape3.Visible:=False;
end;

procedure TForm1.Shape4MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Shape4.Visible:=False;
end;

procedure TForm1.Shape7MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Shape7.Visible:=False;
end;

procedure TForm1.Shape6MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Shape6.Visible:=False
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
if   (Shape1.Visible=False) and (Shape2.Visible=False) and  (Shape3.Visible=False) and  (Shape4.Visible=False) and  (Shape5.Visible=False) and  (Shape6.Visible=False) and  (Shape7.Visible=False)

then
Shape1.Visible:=True;
Shape2.Visible:=True;
Shape3.Visible:=True;
Shape4.Visible:=True;
Shape5.Visible:=True;
Shape6.Visible:=True;
Shape7.Visible:=True;

zeit1:=0;

end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  Button1.Visible:=True;
  Button2.Visible:=True;
  Button3.Visible:=False;
  Button4.Visible:=False;

  Shape5.Visible:=False;
  Shape5.Visible:=False;
  Shape5.Visible:=False;
  Shape5.Visible:=False;
  Shape5.Visible:=False;
  Shape5.Visible:=False;
  Shape5.Visible:=False;

  timer1.Enabled:=false;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  Application.Terminate;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin

  zeit1:=zeit1+1;
  label2.Caption:=IntToStr (zeit1);
end;

end.


Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
Hugo343
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114
Erhaltene Danke: 2

Windows 7
Turbo Delphi, Dev C++
BeitragVerfasst: So 20.12.09 18:07 
du kannst auch mit ...
ausblenden Delphi-Quelltext
1:
if image1.canvas.Pixels[x,y]=clred then //....					

...eine farbüberprüfung machen.
dann bräuchtest du nur noch ein TImage auf dem du dann deine kreise zeichnen lässt.
Mitmischer 1703
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 754
Erhaltene Danke: 19

Win 7, Debian
Delphi Prism, Delphi 7, RAD Studio 2009 Academic, C#, C++, Java, HTML, PHP
BeitragVerfasst: Sa 03.04.10 09:05 
Könnte man da nicht im OnMouseUp des Formulars das Formularcanvas nehmen und mit den Koordinaten weiterarbeiten? Dann müsste man nur selber zeichnen...

_________________
Die Lösung ist nicht siebzehn.
essaah
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Mo 21.03.11 16:42 
kannst du mal den quelltext hochladen? ich wollte sowas ähnliches schreiben und komm aber zu keine anfang
bfelix
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 61

WIN 2000 Prof., Win XP Prof., Win 7 Starter und Prof., SuSe Linux 11.3,
Delphi 7 Pers.
BeitragVerfasst: Mo 21.03.11 20:50 
Das mit dem Zeit zählen kannst du so machen:
Beim Spielstart:
ausblenden Delphi-Quelltext
1:
start:=GetTickCount;					

Wenn fertig:
ausblenden Delphi-Quelltext
1:
ende:=GetTickCount;					


ende-start ergibt dann die Zeit dazwischen in Millisekunden

Moderiert von user profile iconNarses: Delphi-Tag repariert.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 23.03.11 00:45 
Statt GetTickCount würde ich eher zum PerformanceCounter raten, der ist ein bisschen genauer. Such mal im Forum nach QueryPerformanceCounter. ;)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 23.03.11 07:15 
Die paar Millisekunden sollten als Zeitmessung in solche einem Spiel wohl egal sein. :lol: ;-)