Fix randomInt

This commit is contained in:
Sam El-Husseini
2018-06-01 11:42:38 -07:00
parent b5814709f8
commit 6f148c14e0
61 changed files with 152 additions and 158 deletions

View File

@ -193,8 +193,8 @@ while (true) {
}
if (hero.isTouching(food)) {
game.addScore(1);
food.set(LedSpriteProperty.X, Math.randomInt(5));
food.set(LedSpriteProperty.Y, Math.randomInt(5));
food.set(LedSpriteProperty.X, Math.randomRange(0, 5));
food.set(LedSpriteProperty.Y, Math.randomRange(0, 5));
}
}
@ -241,8 +241,8 @@ while (true) {
}
if (hero.isTouching(food)) {
game.addScore(1);
food.set(LedSpriteProperty.X, Math.randomInt(5));
food.set(LedSpriteProperty.Y, Math.randomInt(5));
food.set(LedSpriteProperty.X, Math.randomRange(0, 5));
food.set(LedSpriteProperty.Y, Math.randomRange(0, 5));
if (food.get(LedSpriteProperty.X) < 2 && food.get(LedSpriteProperty.Y) < 2) {
ghost.set(LedSpriteProperty.X, 4);
ghost.set(LedSpriteProperty.Y, 4);