Fix #34 : undefined reference was due to abuse of game.rnd.integerInRange out of bounds

This commit is contained in:
2014-07-06 15:48:27 -07:00
parent 63ed93a653
commit 3e27b50a80
2 changed files with 5 additions and 3 deletions

View File

@@ -60,9 +60,7 @@ function nearestInGroup(sprite, group, sprite_group) {
var nearest = null;
var lastdist = 0.0;
for ( var i = 0 ; i < group.length; i++ ) {
console.log("Checking distance to group[" + i + "]");
var spr = group.getChildAt(i);
console.log(spr);
if ( (typeof sprite_group !== undefined) &&
spr.sprite_group !== sprite_group )
continue;
@@ -342,6 +340,6 @@ function awardPlayerScoreByState(state)
function getRandomTreasure()
{
var treasures = Object.keys(moonlightTreasures);
var treasure = treasures[game.rnd.integerInRange(0, treasures.length)];
var treasure = treasures[game.rnd.integerInRange(0, treasures.length-1)];
return treasure;
}