![]() |
Probleme bei Highscore Gestaltung
Ich verfasse den Artikel in diesem Thread, da es sich um die Highscore von meinem Spiel handelt.
Ich wollte folgendes Problem an die schlauen Mengen bringen. Wie schaffe ich, dass ich bei der falschen Antwort die Punkte und den Namen in die Stringgrid Tabelle eintragen kann und wie binde ich mein Bubblesort ein?
Code:
Gilt auch für die anderen Buttons. Die Buttons sind in Form3
procedure TForm3.Button4Click(Sender: TObject);
begin edit6.TEXt:=inttostr(Vergleichszahl); Zahl:=1; if Zahl=Vergleichszahl then begin showmessage('Richtig!!! NARF'); read(summefragen, frage); Edit1.text:=Frage.Frage;n:=strtoint(Edit7.Text); Edit7.Text:=inttostr(n+100); Edit2.text:=Frage.Antwort1; Edit3.text:=Frage.Antwort2; Edit4.text:=Frage.Antwort3; Edit5.text:=Frage.Antwort4; Vergleichszahl:=frage.richtig; Edit8.Text:=inttostr(n);Button4.Visible:=true; Button5.Visible:=true; Button6.Visible:=true; Button7.Visible:=true end else begin showmessage('Game Over.....') ; Form3.Visible:=false; Form4.Visible:=true; end; end;
Code:
Der dagt mir immer das ''' kein gültiger Integer Wert ist :wiejetzt:
var
Form4: TForm4; var i,j:integer; s:string; procedure TForm4.FormCreate(Sender: TObject); begin with StringGrid1 do begin StringGrid1.Cells[0,0]:= 'Platzierung'; StringGrid1.Cells[1,0]:= 'Spielername'; StringGrid1.Cells[2,0]:= 'Punktezahl'; StringGrid1.Cells[0,1]:= '1.Platz'; StringGrid1.Cells[0,2]:= '2.Platz'; StringGrid1.Cells[0,3]:= '3.Platz'; StringGrid1.Cells[0,4]:= '4.Platz'; StringGrid1.Cells[0,5]:= '5.Platz'; StringGrid1.Cells[0,6]:= '6.Platz'; StringGrid1.Cells[0,7]:= '7.Platz'; StringGrid1.Cells[0,8]:= '8.Platz'; StringGrid1.Cells[0,9]:= '9.Platz'; StringGrid1.Cells[0,10]:= '10.Platz'; for i:=1 to 10 do stringgrid1.cells[2,i]:=inttostr(i); for j:=1 to 10 do for i:=1 to 10 do begin if strtoint(stringgrid1.cells[2,i])>strtoint(stringgrid1.cells[2,i+1]) then //Vergleich der Spalte i und ihrer nachfolgenden Spalte begin //Bedingung erfüllt - Spalte 1 größer als Spalte 2 s:=stringgrid1.cells[2,i]; //Inhalt von Zelle 1 in Tauschvariable stringgrid1.cells[2,i]:=stringgrid1.cells[2,i+1]; //Inhalt von Zelle 2 in Zelle 1 stringgrid1.cells[2,i+1]:=s; //Inhalt von Tauschvariable in Zelle 2 end; end; end; Vielen Dank schon mal für die Hilfe im vorhinein. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:38 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz