Autor Beitrag
juKx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45

WinXp Pro Sp2
Delphi 7 Enterprise Edition
BeitragVerfasst: Do 30.03.06 16:53 
hi,

ich bin gerade bei einem spiel...ich möchte das wenn der Spieler game over ist das das spiel von vorne wieder anfängt, weil ich form.create und auch andere Prozeduren zurückgesetzt werden müssen. am besten:
ausblenden Quelltext
1:
2:
form1.close
form1.showmodal;


aber geht ja nicht :(

_________________
ausblenden Quelltext
1:
Ich programmiere sehr gerne, bloß mein Rechner nicht, Oo!					
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 30.03.06 17:00 
dann lager doch alles, was du im formcreate hast, in eine andere procedure aus, ruf diese vom formcreate aus auf und dann anschließend auch von der stelle, wo du quasi neustarten willst...
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 30.03.06 17:02 
form1.hide mal probiert ?
du kannst sie ja net schließen und dann anzeigen, wenn sie garnet mehr da ist....
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 30.03.06 17:03 
dadurch wird formcreate ja auch nicht neu aufgerufen ;)
juKx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45

WinXp Pro Sp2
Delphi 7 Enterprise Edition
BeitragVerfasst: Do 30.03.06 17:03 
hi,

danke erstmal für deine antwort. das problem ist das ich eine schleife drin habe die sich die ganze zeit selbst aufruft und diese auch neugestartet werden müsste(IdleHandler, OpenGL)..

gruß juKx

_________________
ausblenden Quelltext
1:
Ich programmiere sehr gerne, bloß mein Rechner nicht, Oo!					
juKx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45

WinXp Pro Sp2
Delphi 7 Enterprise Edition
BeitragVerfasst: Do 30.03.06 17:07 
oder gibt es nicht sowas wie
ausblenden Quelltext
1:
Form1.recreate					

??

_________________
ausblenden Quelltext
1:
Ich programmiere sehr gerne, bloß mein Rechner nicht, Oo!					
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 30.03.06 17:11 
nein, du packst das in ne extra funktion, benutzt hide und beim neuen spiel rufst du dann die funktion auf (im oncreate dann auch)
Sinspin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1340
Erhaltene Danke: 120

Win 10
RIO, CE, Lazarus
BeitragVerfasst: Do 30.03.06 17:23 
programiertechnisch wäre es sicher einfacher deine programmstruktur so zu verändern das du das eigentliche spiel in einem weiteren fenster anzeigst was bei spielende komplett geschlossen wird. oder du baust dir alles in OGL und zwar immer in dem gleichen fenster. das lößt eine ganze menge probleme. und sieht auch genialer aus wenn es mal fertig ist.

_________________
Wir zerstören die Natur und Wälder der Erde. Wir töten wilde Tiere für Trophäen. Wir produzieren Lebewesen als Massenware um sie nach wenigen Monaten zu töten. Warum sollte unser aller Mutter, die Natur, nicht die gleichen Rechte haben?
muppet max
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 30.03.06 17:26 
Titel: was
was für einen sinn hat das schließen und öffen ? :gruebel:
juKx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45

WinXp Pro Sp2
Delphi 7 Enterprise Edition
BeitragVerfasst: Do 30.03.06 17:41 
hi,

ich habe ja 2 forms.. form1 ist das menu und form2 das spiel..

_________________
ausblenden Quelltext
1:
Ich programmiere sehr gerne, bloß mein Rechner nicht, Oo!					
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 30.03.06 17:42 
und welches willst du nun "rebooten"?
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Do 30.03.06 17:46 
mach doch einfach

ausblenden Delphi-Quelltext
1:
2:
3:
  Form2.Close;
  Form2.FormCreate(nil);
  Form2.Show;


greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 30.03.06 17:47 
darauf wollt ich hinaus...mit form2 kann man das machen... mit form1 würds nicht gehen, da wird das prog beendet... aber nicht bei form2 :)
juKx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45

WinXp Pro Sp2
Delphi 7 Enterprise Edition
BeitragVerfasst: Do 30.03.06 17:48 
also mal zur struktur:

wenn exe geöffnet dann gehe ich in form1(menu) dann wenn ok geklickt dann form1.close und form2.show...wenn jetzt game over dann form1.show und form2.close...aber dann geht er ganz raus..eigentlich müsste ich doch jtzt zwischen den fenster springen könne!?

_________________
ausblenden Quelltext
1:
Ich programmiere sehr gerne, bloß mein Rechner nicht, Oo!					
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 30.03.06 18:01 
also ist form2 dein hauptform? dieses zu schließen beendet das prog.
du könntest es so drehen, dass dein hauptform das menü ist. wenn das spiel gestartet wird, versteckst dus mit form1.hide . dann kannst dus nach dem spiel mit form1.show wieder aufrufen und form2 mit close schließen...
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 30.03.06 18:27 
:autsch:, Leute.

Wenn man bei einem Programm an mehreren Stellen seine Startwerte wieder braucht, dann schreibt man eine Prozedur, in der diese Werte entsprechend gesetzt werden.
Wenn man das am Start auch benötigt (dürfte ja meistens so sein), dann ruft man diese Prozedur im FormCreate auf. Und immer wieder dann, wenn man es braucht. Das mit dem Schließen des Fensters und rumtricksen, dass das Menü die Hauptform ist...Ne.

_________________
We are, we were and will not be.
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 30.03.06 18:30 
@gausi

das war das, was ich ganz zu anfang sagte...
aaaber das wollte jukx nicht...
tja, dann sucht man alternativen...
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 30.03.06 19:19 
normal dass das programm schließst, wenn du auch das hauptfenster zumachst UND NICHT AUF MICH HÖRST ! :evil:
Zyklame
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41
Erhaltene Danke: 1

Win 7 Professional
Delphi XE, Visual Studio 2010
BeitragVerfasst: Mi 05.04.06 08:43 
eine Lösung wäre es im Hauptprogramm die Form neu zu starten

irgendwo unter ansicht/Units müsste wie die Exe datei heißen
chriss1988
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Mi 05.04.06 08:49 
mann könnte es doch so lösen


form 1

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
begin
form2.show;
form1.hide;
end;


form2 dann so
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
begin
form2.close;
form1.show;
end;


müsste so funktionieren