| | |
Need help programming a Delphi dice game
![]() |
•
•
Join Date: Dec 2002
Posts: 12
Reputation:
Solved Threads: 0
Hi,
I need someone to help me create a program which will simulate the rolling of a die, counting how many of each die faces appear on the screen. This program should also explore the use of arrays.
Would appreitiate help greatly.
thank you,
Test
I need someone to help me create a program which will simulate the rolling of a die, counting how many of each die faces appear on the screen. This program should also explore the use of arrays.
Would appreitiate help greatly.
thank you,
Test
Hmm i am a test acount how vcome im still here? :idea:
•
•
Join Date: Dec 2002
Posts: 12
Reputation:
Solved Threads: 0
so far i have,
procedure TDiceForm.resetClick(Sender: TObject);
begin
randomize;
for j := 1 to 6 do
numb [j] := 0;
Button11.Caption := '';
Button12.Caption := '';
Button13.Caption := '';
Button14.Caption := '';
Button15.Caption := '';
Button16.Caption := '';
end;
procedure TDiceForm.startstopClick(Sender: TObject);
begin
Timer1.Enabled := not Timer1.Enabled;
end;
procedure TDiceForm.Timer1Timer(Sender: TObject);
var die: integer;
begin
die := random(6) + 1; {random numbers of dice: 1-6}
DieImage.Picture.LoadFromFile(IntToStr(die) + '.bmp'); {convert die value to
string, add bitmap extension, load from file, and display as DieImage}
numb[die] := numb[die] + 1;
case die of
1:CountOneButton.Caption := IntToStr(numb[die]);
2:CountTwoButton.Caption := IntToStr(numb[die]);
3:CountThreeButton.Caption := IntToStr(numb[die]);
4:CountFourButton.Caption := IntToStr(numb[die]);
5:CountFiveButton.Caption := IntToStr(numb[die]);
6:CountSixButton.Caption := IntToStr(numb[die]);
end;
procedure TDiceForm.resetClick(Sender: TObject);
begin
randomize;
for j := 1 to 6 do
numb [j] := 0;
Button11.Caption := '';
Button12.Caption := '';
Button13.Caption := '';
Button14.Caption := '';
Button15.Caption := '';
Button16.Caption := '';
end;
procedure TDiceForm.startstopClick(Sender: TObject);
begin
Timer1.Enabled := not Timer1.Enabled;
end;
procedure TDiceForm.Timer1Timer(Sender: TObject);
var die: integer;
begin
die := random(6) + 1; {random numbers of dice: 1-6}
DieImage.Picture.LoadFromFile(IntToStr(die) + '.bmp'); {convert die value to
string, add bitmap extension, load from file, and display as DieImage}
numb[die] := numb[die] + 1;
case die of
1:CountOneButton.Caption := IntToStr(numb[die]);
2:CountTwoButton.Caption := IntToStr(numb[die]);
3:CountThreeButton.Caption := IntToStr(numb[die]);
4:CountFourButton.Caption := IntToStr(numb[die]);
5:CountFiveButton.Caption := IntToStr(numb[die]);
6:CountSixButton.Caption := IntToStr(numb[die]);
end;
Hmm i am a test acount how vcome im still here? :idea:
![]() |
Similar Threads
- "Craps", Game Help (C++)
- C++ game? (C++)
- Programming Contest - Play a game (C)
- Help with dice game! (C++)
- Craps, game help! (C++)
- New To Programming = ME!! (C++)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: Returning from a sleep screen using Delphi
- Next Thread: Sound and Graphics?
Views: 4259 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Pascal and Delphi
animation app array button compile console data database dbisam delete delphi delphihelpimageforloop documentcomplete2 edit environment error errors events file form function gdi gis lasrautoinc media navigatecomplete2 network object open opengl pascal passing path player procedure search set sql table twebbrowser variable win7





