Autor Beitrag
GI_PC
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: So 16.03.08 16:32 
Hallo,

Ich möchte ein Spiel, "Memory Karte" programmieren, kann ihr mir bitte dabei helfen. Ich verstehe nicht sehr viel von Delphi.

Kann ihr mir villeicht sagen, wie das macht, wenn jemand Level 1 geschafft hat und auf Level 2 kommt, wie muss ech das machen? muss ich da vielleicht, ein paar diese frMain FEnster erstellen? Und wie link man das zusammen?

Bitte erklärt mir

Danke


Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 16.03.2008 um 15:55
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 16.03.08 16:56 
Moin und :welcome: im Forum!

Schau mal hier, vielleicht kommst du damit schon weiter. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Mi 19.03.08 20:21 
Danke sehr Narses :)
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Mi 19.03.08 22:04 
eine Frage, wie macht man das:

als ich auf den button klicke, erschéint da ein Bild, und vorher soll das Bild jo versteckt sein.
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Mi 19.03.08 22:08 
Im Objektinspektor die Eigenschaft 'Visible' auf false setzen.

und dann in der ButtonOnClick procedure:

ausblenden Delphi-Quelltext
1:
image.visible:=true;					
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Do 20.03.08 12:06 
Wie macht man random von Bilder/fotoen?
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Do 20.03.08 14:03 
ganz einfach, so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
  rand: Integer;
  myimage: TImage;
begin
  randomize;
  rand := random(5);
  case rand of
    1 : myimage := Image1;
    2 : myimage := Image2;
    3 : myimage := Image3;
    4 : myimage := Image4;
    5 : myimage := Image5;
  end;
  // myimage ist ein zufällig gewähltes Image
end;
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Fr 21.03.08 10:06 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
case rand of
    1 : myimage := Image1;
    2 : myimage := Image2;
    3 : myimage := Image3;
    4 : myimage := Image4;
    5 : myimage := Image5;
  end;


was hat die Zahlen vor "myimage" eine Bedeutung? Es musst nicht unbedingt "myimage" benutzt werden, oder?

"case rand of" ist das "case of"? ist ja das gleiche wie "if... then...else.."


diese Code soll jo im FormCreate schreiben, oder?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
  rand: Integer;
  myimage: TImage;
begin
  randomize;
  rand := random(5);
  case rand of
    1 : myimage := Image1;
    2 : myimage := Image2;
    3 : myimage := Image3;
    4 : myimage := Image4;
    5 : myimage := Image5;
  end;

end;


Moderiert von user profile iconNarses: Code- durch Delphi-Tags ersetzt
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Fr 21.03.08 10:38 
"rand" ist eine Integer-Variable. Du könntest genauso schreiben: case (rand) of. Wenn du das übersichtlicher findest. Also ja, es ist ein case-of. Das ist auch dasselbe wie:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
if rand = 1 then
  myimage := Image1
  else if rand = 2 then
    myimage := Image2
    else if rand = 3 then
      myimage := Image3
      else if rand = 4 then
        myimage := Image4
       else if rand = 5 then
         myimage := Image5;
end;

==> Delphi-Hilfe -> case

Und du schreibst es dorthin, wo etwas zufällig gewählt werden soll. FormCreate, FormActivate, oder in die OnClick eines Buttons.

Und wie du die Variable nennst, ist egal. Du schreibst dann eben nicht Image1, sondern myimage.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 24.03.08 18:15 
Wenn die Bilder eh alle Image<n> heißen, kann man auch einfach

ausblenden Delphi-Quelltext
1:
MyImage := TImage(FindComponent('Image' + IntToStr(Rand(5)+1)));					


machen. Ist zwar etwas langsamer, dafür aber erweiterbar ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Mo 24.03.08 18:29 
Ich hab mich schon immer gefragt, ob man das nicht mit FindComponent() machen könnte. Aber leider habe ich da nicht an Typumwandlung gedacht.
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Fr 28.03.08 21:33 
Gibt da vieleicht ein anders möglichkeit für das Spiel Memory Karte zu programmieren? Für Anfänger von Delphi? mehr einfach vielleicht
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 28.03.08 21:42 
Z.B. www.duden.de kann da helfen ;-)

Jup. Du kannst z.B. mit Resourcen (Bitmaps) arbeiten, die Du dann in TImages lädst.

Oder was meinst Du genau?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: So 30.03.08 11:23 
Ja, also einfacher.
Mit Bitmaps, habe ich auch schon benutzt.

Ich meine auch noch z.B mehr if und nicht so viel procedure, halt wirklich für Anfänger, denn ich kenne noch nicht so gut mit Delphi aus.

Narses hat mir ein Tutorial gegeben und das war zu schwer für mich, da sind viele Sachen die ich noch nie gesehen habe.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 30.03.08 11:57 
Moin!

user profile iconGI_PC hat folgendes geschrieben:
Ich meine auch noch z.B mehr if und nicht so viel procedure, halt wirklich für Anfänger, denn ich kenne noch nicht so gut mit Delphi aus.

Narses hat mir ein Tutorial gegeben und das war zu schwer für mich, da sind viele Sachen die ich noch nie gesehen habe.
Vielleicht solltest du einfach mal in Betracht ziehen, dass das Spiel Memory nachzuprogrammieren aktuell noch etwas zu schwer für dich ist. :?

Wenn also große Schritte am Anfang zu viel sind, wie wäre es mit kleineren? ;) Zum Beispiel Zahlenraten (du denkst dir eine Zahl aus und der Compi versucht, sie zu erraten, du antwortest mit größer, kleiner, getroffen) oder TicTacToe (auch also XXO bekannt). :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Mo 31.03.08 10:56 
user profile iconNarses hat folgendes geschrieben:


Vielleicht solltest du einfach mal in Betracht ziehen, dass das Spiel Memory nachzuprogrammieren aktuell noch etwas zu schwer für dich ist. :?



Aber das ist ein Projekt, in unser Info. Unterricht, aber wenn das zu schwer ist, warum hat mein Lehrer mir nichts gesagt. :x

Narses, danke für deine Vorschläge, ist lieb von dir.
Something
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Mo 31.03.08 12:29 
Hallo GI_PC

Es hat zwar nichts mit deinem Quelltext zu tun, jedoch wollte ich dich Informieren, dass der Name Memory ein Markenname ist und du dich strafbar machen könntest, wenn du es benutzt.

Ich habe nämlich vor ein paar Jahren selbst ein Memory-Programm geschrieben und wollte es unter dem Namen "Ultimative Memory" veröffentliche. Als ich das tat, wurde ich von Ravensburger informiert, dass der Name nicht Memory erhalten darf, da ich mich sonst strafbar gemacht hätte und musste es deshalb in "Ultimative Gedächtnis" umbenennen.

Viel Erfolg noch beim schreiben des Programms !
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Mi 02.04.08 22:15 
user profile iconSomething hat folgendes geschrieben:


Es hat zwar nichts mit deinem Quelltext zu tun, jedoch wollte ich dich Informieren, dass der Name Memory ein Markenname ist und du dich strafbar machen könntest, wenn du es benutzt.

Ich habe nämlich vor ein paar Jahren selbst ein Memory-Programm geschrieben und wollte es unter dem Namen "Ultimative Memory" veröffentliche. Als ich das tat, wurde ich von Ravensburger informiert, dass der Name nicht Memory erhalten darf, da ich mich sonst strafbar gemacht hätte und musste es deshalb in "Ultimative Gedächtnis" umbenennen.



Hey Something,
Danke für deine Warnung :lol:

Ich habe das so gesagt, weil ich nicht weiss wie ich es erklären sollte und ich glaube so weiss jeder was ich meine. :roll: :wink: