mardi 24 février 2015

How do I make an event in Delphi happen just once?

I'm a starter programmer and I'm trying to make a text-based RPG game (Like Zork) using Delphi Pascal language. I made an event in which the main character open a chest and find some items:



begin
text1.text := 'You see a chest. It is unlocked.';
end;
if edit1.Text = 'Open Chest' then
text1.Text := 'You found 50 Gold Pieces, a Short Sword, a Cloth Armor and a Satchel Bag.';
end;


But I want to make it in a way that, whenever someone opens the chest AFTER the first time, the chest will be empty, since the player already took the items. In other words, when someone type 'Open Chest' in the TEdit for the second time, it says something like "It is empty."


But how?


Aucun commentaire:

Enregistrer un commentaire