Skip to content

Commit

Permalink
Remove unicode chars from variable bat_js.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaman committed Jun 13, 2022
1 parent 280530b commit c7a2cbf
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions tutorials/variable/intermediate/bat_js.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Bat Cave: JavaScript
# Bat Cave: Blocks

## Step 1
Add an ``||player:on chat||`` command and name it **cave**.
Rename the existing ``||player:on chat||`` command **cave**.

```javascript
```blocks
player.onChat("cave", function () {
})
```

## Step 2

Code the player to ``||player:say||``by typing **"Dig a cave"**, and drag it into the ``||player:on chat||`` command.
Get a ``||player:player say||`` command, type **"Dig a cave"**, and drag it into the ``||player:on chat||`` command.

```javascript
```blocks
player.onChat("cave", function () {
player.say("Dig a cave")
})
```

## Step 3

Set the time of day to **day**.
Get a ``||gameplay:time set||`` block, set it **day**, and drag it into the ``||player:on chat||`` **cave** command - below the ``||player:say||`` command.

```javascript
```blocks
player.onChat("cave", function () {
player.say("Dig a cave")
gameplay.timeSet(gameplay.time(DAY))
Expand All @@ -31,9 +31,9 @@ player.onChat("cave", function () {

## Step 4

Code the player to ``||blocks:fill with||`` an **air** block with these positions: **from = -1.0,-1** and **to = 1,2,1**. Code it to **replace**.
Get a ``||blocks:fill with||`` block and select an **air** block with these positions: **from -1.0,-1** and **to 1,2,1**. Set it to **replace**.

```javascript
```blocks
player.onChat("cave", function () {
player.say("Dig a cave")
gameplay.timeSet(gameplay.time(DAY))
Expand All @@ -48,9 +48,9 @@ player.onChat("cave", function () {

## Step 5

Repeat the fill step **50** times.
Get a ``||loops:repeat||`` loop and set it to **50** times. Drag the ``||blocks:fill with||`` **air** block into the loop, then drag the entire ``||loops:repeat||`` loop into the ``||player:on chat||`` **cave** command below the ``||gameplay:time set||`` **day** command.

```javascript
```blocks
player.onChat("cave", function () {
player.say("Dig a cave")
gameplay.timeSet(gameplay.time(DAY))
Expand All @@ -67,9 +67,10 @@ player.onChat("cave", function () {

## Step 6

Set a ``||variables:new variable||`` and name it **bat_cave**, then set that variable to the ``||player:player world position||``.
Get a ``||variables:set variable||`` and assign it a new variable called **bat_cave**. Get a ``||player:player world position||`` and drag it into the **bat_cave** variable.
Drag the newly completed ``||variables:set variable||`` **bat_cave** into the ``||player:on chat||`` command **cave** below the ``||loops:repeat||`` loop **50**.

```javascript
```blocks
let batcave: Position = null
player.onChat("cave", function () {
player.say("Dig a cave")
Expand All @@ -88,53 +89,53 @@ player.onChat("cave", function () {

## Step 7

Code the player to ``||player:say||`` You have 10 seconds to go out before the bats arrive.
Get a ``||player:say||`` block and code it as "You have 10 seconds to go out before the bats arrive." Drag it into the ``||player:on chat||`` **cave** command below the **bat_cave** variable.

```javascript
```blocks
player.say("You have 10 seconds to get out before the bats arrive.")
```

## Step 8

``||loops: Pause||`` the code for **10** seconds (10,000 ms).
Get a ``||loops: pause||`` loop and set it to **10** seconds (10,000 ms). Drag this loop into the end of the ``||player:on chat||`` command.

```javascript
```blocks
player.say("You have 10 seconds to get out before the bats arrive.")
loops.pause(10000)
player.on_chat("cave", on_chat)
```

## Step 9

After the pause, code the player to sayWatch out for bats!”.
Get another ``||player:player say||``command and code the player to say, "Watch out for bats!". Drag the newly completed ``||player:player say||`` into the ``||player:on chat||`` command at the end.

```spy
```blocks
loops.pause(10000)
player.say("Watch out for bats!")
player.on_chat("cave", on_chat)
```

## Step 10

Set the time to **dusk**.
Duplicate the ``||gameplay:time set||`` **day** (from step 3) and set it to **dusk**. Drag it into the end of the ``||player:on chat||`` command.

```javascript
```blocks
gameplay.timeSet(gameplay.time(DUSK))
```

## Step 11

``||mobs:Spawn||`` a bat at the **bat_cave** variable.
Get a ``||mobs:spawn animal||`` block and drag it into the workspace, select **bat** and assign the **bat_cave** variable.

```javascript
```blocks
mobs.spawn(BAT, batcave)
```

## Step 12

Repeat the **bat** ``||mobs:spawn animal||`` **200** times.
Next, repeat the **bat** ``||mobs:spawn animal||`` step. Get a ``||loops:repeat||`` loop and set it to **200** times. Drag the **bat** into the loop. Drag the entire loop into the ``||player:on chat||`` **cave** command below the ``||gameplay:time set||`` **dusk** block.

```javascript
```blocks
for (let index = 0; index < 200; index++) {
mobs.spawn(BAT, batcave)
}
Expand All @@ -144,8 +145,7 @@ for (let index = 0; index < 200; index++) {

Go into Minecraft and type **cave** in the chat to see all the code run.


```javascript
```blocks
let batcave: Position = null
player.onChat("cave", function () {
player.say("Dig a cave")
Expand Down

0 comments on commit c7a2cbf

Please sign in to comment.