tags:

views:

48

answers:

1
+1  A: 

The problem is in how they're doing the bindings, with the 1.4.2 event model re-write that approach just doesn't work anymore, but you can write it to work with 1.4.2, like this:

function jqrpgBindKeys() {
    $(document).bind('keydown', function(e) {
        if (jqr.p.state != 'map' && e.which != 32) return false;
        switch(e.which) {
          case 38: //up
            jqrpgSetPlayerFace('u');
            return jqrpgMovePlayer(0, -1);
          case 40: //down
            jqrpgSetPlayerFace('d');
            return jqrpgMovePlayer(0, 1);
          case 37: //left
            jqrpgSetPlayerFace('l');
            return jqrpgMovePlayer(-1, 0);
          case 39: //right
            jqrpgSetPlayerFace('r');
            return jqrpgMovePlayer(1, 0);
          case 32: //space bar
            if (jqr.p.state == 'map') return false;
            jqr.settings.space = true;
            if (jqr.p.state == 'battle') jqrpgBattle();
            return true;
        }
    });
}

You can give it a try (using jQuery 1.4.2) here. You could also do this via an object map, etc...but this is the quick change version to make it work with 1.4.2.


Separate issue: The problem is in your webhost, well...screwing with your page. If you look at the source on http://www.project-vanquish.co.cc/jQRPG/ you'll see this at the end (modified to remove real domains):

</body> 
</html> 
<!-- www.removedToProtectTheGuilty.com Analytics Code --> 
<script type="text/javascript" src="http://analytics.example.com/count.php"&gt;&lt;/script&gt; 
<noscript><a href="http://www.example.com/"&gt;&lt;img src="http://analytics.example.com/count.php" alt="web hosting" /></a></noscript> 
<!-- End Of Analytics Code --> 

That script executing after </html> causes all sorts of craziness around document.ready and will just give problems in general...if at all possible get rid of it, or try and get it inside <body></body>. Some webhosts look for a tag to stick it in, e.g.:

 <div id="analyticsCodeHere"></div>

I'd see if you have that option :)

Nick Craver
Perfect, cheers Nick. Even if it wasn't the news I wanted to hear.
Neurofluxation
This same issue happens if I use jQuery 1.4.2 as well, I had to degrade to 1.4.1 to get the functionality correct ;)
Neurofluxation
@Neurofluxation - You're right, I looked through the 1.4.2 commits and the way they were doing keycodes just breaks with the 1.4.2 event model re-write. Check the updated answer, I included how to make it more check correctly...this will have no issues in 1.4.2.
Nick Craver