Fix randomInt
This commit is contained in:
@ -13,13 +13,13 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
|
||||
## 1. Write the code that will store the global variable named 'action' and returns a random number between 0 and 2
|
||||
|
||||
```blocks
|
||||
let action = Math.randomInt(3)
|
||||
let action = Math.randomRange(0, 3)
|
||||
```
|
||||
|
||||
## 2. Write the code that will display the string, "PUSH A" if the global variable called 'action' is equal to 0
|
||||
|
||||
```blocks
|
||||
let action = Math.randomInt(3)
|
||||
let action = Math.randomRange(0, 3)
|
||||
if (action == 0) {
|
||||
basic.showString("PUSH A", 150)
|
||||
}
|
||||
@ -29,7 +29,7 @@ if (action == 0) {
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
let action = Math.randomInt(3)
|
||||
let action = Math.randomRange(0, 3)
|
||||
if (action == 0) {
|
||||
game.addScore(1)
|
||||
}
|
||||
@ -39,7 +39,7 @@ input.onButtonPressed(Button.A, () => {
|
||||
## 4. Write the code that will display the string "LOGO DOWN" if the global variable called 'action' is equal to 1
|
||||
|
||||
```blocks
|
||||
let action = Math.randomInt(3)
|
||||
let action = Math.randomRange(0, 3)
|
||||
if (action == 1) {
|
||||
basic.showString("LOGO DOWN", 150)
|
||||
}
|
||||
@ -49,7 +49,7 @@ if (action == 1) {
|
||||
|
||||
```blocks
|
||||
input.onLogoDown(() => {
|
||||
let action = Math.randomInt(3)
|
||||
let action = Math.randomRange(0, 3)
|
||||
if (action == 1) {
|
||||
game.addScore(1)
|
||||
}
|
||||
@ -59,7 +59,7 @@ input.onLogoDown(() => {
|
||||
## 6. Write the code that will display the string "SHAKE" if the global variable called 'action' is equal to 2
|
||||
|
||||
```blocks
|
||||
let action = Math.randomInt(3)
|
||||
let action = Math.randomRange(0, 3)
|
||||
if (action == 2) {
|
||||
basic.showString("SHAKE", 150)
|
||||
}
|
||||
@ -69,7 +69,7 @@ if (action == 2) {
|
||||
|
||||
```blocks
|
||||
input.onLogoDown(() => {
|
||||
let action = Math.randomInt(3)
|
||||
let action = Math.randomRange(0, 3)
|
||||
if (action == 1) {
|
||||
game.addScore(1)
|
||||
}
|
||||
|
Reference in New Issue
Block a user