Autor Beitrag
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 18.05.03 11:39 
so, da ich jez weiss was man alles mit array machen kann (thx @ Peter)
wollte ichmeine Quelltext etwas verbessern, habe, aber das problem, dass delphi meine definition des arrays nicht anerkennen will. also: kann mir mal jemand ein beispiel schreiben, wie die definition eines dynamische arrays des objects 'Bullet' aussieht?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 18.05.03 12:00 
Hallo!

Wenn bullet dein Objekttyp ist (eigentlich sollte er dann TBullet heißen!), dann geht das so:

ausblenden Delphi-Quelltext
1:
bullets : ARRAY OF bullet;					


MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 18.05.03 12:28 
Peter Lustig hat folgendes geschrieben:
Hallo!

Wenn bullet dein Objekttyp ist (eigentlich sollte er dann TBullet heißen!), dann geht das so:

ausblenden Delphi-Quelltext
1:
bullets : ARRAY OF bullet;					


MfG,
Peter


wasmeinst du mit objekttyp? bullet is n winziges (2*2Pixel) Image
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 18.05.03 12:32 
Zitat:
wasmeinst du mit objekttyp?
Ein Beispiel: mit TButton bezeichne ich einen Objekttypen. Wenn ich aber auf meine Form einen Button packe, dann ist dieser Button kein Objekttyp, sondern ein Objekt bzw. eine Instanz des Objekttypen! Alle Buttons auf meiner Form sind vom gleichen Typ!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 18.05.03 13:28 
und wenn ich dann als o zig bullets erstellen will, brauch ich

array of bullet

oder

array of tbullet

?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 18.05.03 13:38 
Wenn Du zig Integerzahlen aneinander hängen willst, dann gibst Du doch bei der Deklaration des Arrays auch an
ausblenden Delphi-Quelltext
1:
my_ints : Array of Integer;					


Es würde ja keinen Sinn machen, wenn Du es so machst:
ausblenden Delphi-Quelltext
1:
my_ints : Array of my_int;					


Entsprechend musst Du es bei Deinen bullets machen.

MfG,
Peter

P.S.: In dem Tutorial steht das übrigens auch drin. Nur halt für Buttons und nicht für Bullets.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 18.05.03 18:04 
also das gnaze mit Tbullet?
aber delphi meint es gibt kein Tbullet
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 18.05.03 18:22 
Du musst es schon noch deklarieren. Poste doch mal bitte Deinen bisherigen Programmkopf!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 18.05.03 18:28 
bla bla
....
Bullet: TImage;
....
bla bla
....
Bullets : array of TBullet;
....
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 18.05.03 18:37 
Ach so! Ich dachte Du hättest für Deine Kugeln einen eigenen Typen definiert! Du übernimmst doch hier den Typen TImage. Dann sollte doch auch klar sein, wie Deine Array-Deklaration aussieht. Ein Array wird doch (wie im Tutorial beschrieben!) doch als "my_array : Array of Typ" deklariert.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 18.05.03 18:41 
aber wohersoll delphi wissen ,das all diese kleinen lustige TImages 2*2 Pixel groß sind?
gibtsein tutorial zum eigene typen basteln?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 18.05.03 19:03 
Wie so oft bei Delphi-Source. Wenn das nicht reicht mal googlen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".