主人公がとある地点でキーボードのAkeyを取得した時に、会話が始まるようなプログラムが組みたいのですが、
今の状態ですと、Akey1回で会話をスムーズに行うことが出来ません。
また、そのせいで会話が終了した直後に再度会話を取得してしまうことがあります。
Akey1回毎に、会話を次へと表示させて、一旦終了させ再びAkeyを押した時に会話をさせるにはどうすればよいでしょうか。
その他に、会話のテキストを1文字ずつ時間をあけて表示させる場合のプログラム、または関数について教えて下さると助かります。
VisualStudio 2013
DXライブラリ
を使用しております。
if (CheckHitKey(KEY_INPUT_A) == 1 && control[4] == 1){
brack = GetColor(0, 0, 0);//黒色
red = GetColor(255, 0, 0);//黒色
white = GetColor(255, 255, 255);//白色
DrawBox(50, 330, 320, 444, white, TRUE);
DrawFormatString(62, 350, brack, "今あなたは元気ですか?");
ScreenFlip();
WaitTimer(100);
WaitKey();
control[4] = 2;
}
if (control[4] == 2){
DrawBox(50, 330, 320, 444, white, TRUE);
while (a == 0){
if (CheckHitKey(KEY_INPUT_UP) == 1)
b = 0;
if (CheckHitKey(KEY_INPUT_DOWN) == 1)
b = 1;
if (b == 0){
DrawFormatString(62, 350, red, "はい");
DrawFormatString(62, 382, brack, "いいえ");
ScreenFlip();
WaitTimer(75);
if (CheckHitKey(KEY_INPUT_A) == 1)
a = 1;
}
if (b == 1){
DrawFormatString(62, 350, brack, "はい");
DrawFormatString(62, 382, red, "いいえ");
ScreenFlip();
WaitTimer(75);
if (CheckHitKey(KEY_INPUT_A) == 1)
a = 2;
}
WaitTimer(200);
}
while (a != 0){
DrawBox(50, 330, 320, 444, white, TRUE);
if (a == 1){
DrawFormatString(62, 350, brack, "そうですか!");
DrawFormatString(62, 370, brack, "それはよかったです!");
ScreenFlip();
WaitTimer(100);
if (CheckHitKey(KEY_INPUT_A) == 1)
a = 0;
}
if (a == 2)
{
DrawFormatString(62, 350, brack, "元気ないのですか・・・。");
DrawFormatString(62, 370, brack, "体調には気を付けてくださいね。");
ScreenFlip();
WaitTimer(100);
if (CheckHitKey(KEY_INPUT_A) == 1)
a = 0;
}
}