jquery - How to complete my JavaScript game? -
can me finish game, please? turns out i'm doing game in javascript, html , ajax; "minefield". problem have when throw more 1 request, rebuilds variables , that, rebuilds random field , returns not make sense.
i want create game, , algorithm this:
when user joins web, user puts values in "x" , "y". code put position according user coords. then, program generate random field, if user position red, user lose, in case, if position green user win , if green, user can continue playing , if red user cannot continue playing. in right position of web page, there box shows times user survive.
the problem is: if user wins first time, can continue gaming , when user puts again coords, game generates random field, , of variables of play lose (i mean: variable register times user survive, variables generate field , of variables). want conserve variables. , if user lose, option user has if wants play again way of refresh page.
if want execute on server, can download here: http://files.mastercoria.com/files/downloads/myfiles/juegos/campo-minado-mejorado.zip
cant disable/hide button on click , re-enable/show when ajax returns success?
$(".play").on("click", function(){ $(this).hide(); $.ajax({ ... ... whatever ajax configs here ..., success:function(data){ ...validate ...redraw map $(".play").show(); } }); });
Comments
Post a Comment