move check for locked dice when rerolling
This commit is contained in:
parent
d98d9ece8b
commit
b34b175acd
2 changed files with 3 additions and 5 deletions
|
@ -52,9 +52,7 @@ public class Die extends Actor {
|
|||
}
|
||||
|
||||
public void roll() {
|
||||
if (!locked) {
|
||||
faceIndex = random.nextInt(6);
|
||||
}
|
||||
faceIndex = random.nextInt(6);
|
||||
}
|
||||
|
||||
public void decay() { //remove a pip from all faces of this die
|
||||
|
|
|
@ -46,8 +46,8 @@ public class Game extends ApplicationAdapter {
|
|||
public void processInput() {
|
||||
Input input = Gdx.input;
|
||||
|
||||
if (input.isKeyJustPressed(Input.Keys.R)) { //reroll dice
|
||||
dice.forEach(Die::roll);
|
||||
if (input.isKeyJustPressed(Input.Keys.R)) { //reroll dice that aren't locked
|
||||
dice.stream().filter(d -> !d.isLocked()).forEach(Die::roll);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dice.size(); i++) { //lock dice, iterating over for each keycode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue