Im making a zork style game in HTML using javascript.
My game currently looks like this,
<script>
$(document).keypress(function(event) {
if (event.which == 13) {
$(".output").append("
Inside the append goes what part of the story you want to print. When the user inputs an answer, A/B/C, then it spits out an answer based on if then.
$(document).keypress(function(event) {
if (event.which == 97) {
$(".output").append("
Problem is it will spit out every single answer I have for that input. I need to find a way for HTML or JS to wait for input then continue on.
use:
$(".temporaryoutput").html(" test ");
$(".temporaryoutput").fadeOut(1000);
$(".output").append("test");
append add all your answer to the string. html will show current answer. You can solve the rest with jQuery.Deferred() - https://api.jquery.com/category/deferred-object/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.