owned this note
owned this note
Published
Linked with GitHub
###### tags: `minecraft`
<style>
* {font-family: 'Terminal','ヒラギノ丸ゴ ProN','Hiragino Maru Gothic ProN',YuGothic,'Yu Gothic','Hiragino Kaku Gothic ProN','ヒラギノ角ゴ ProN W3','Verdana','Arial',sans-serif;}
.markdown-body {font-family: 'Terminal','ヒラギノ丸ゴ ProN','Hiragino Maru Gothic ProN',YuGothic,'Yu Gothic','Hiragino Kaku Gothic ProN','ヒラギノ角ゴ ProN W3','Verdana','Arial',sans-serif;}
h2 {padding-top: 50px;}
img {margin: 20px auto;}
.alert-success {margin-top: 50px;}
.alert h2 {padding-top: 0px;}
.part {letter-spacing: .1rem;}
.markdown-body h3 {margin-top: 12px;margin-bottom: 12px;}
.markdown-body p {font-size: 1.25em;margin-top: 12px; margin-bottom: 16px;}
.markdown-body li {font-size: 1.25em;}
.markdown-body pre {font-size: 20px;}
.focus {color: red;font-weight: bold;}
.link-box {display: flex;justify-content: space-between; margin-top: 50px;margin-bottom: 50px;}
a.link {display: block; width: 50%; padding: 10px 15px; text-align: center; color: #fff; font-weight: bold; font-size: 20px; letter-spacing: .1em; text-decoration: none;}
a.link:hover {opacity: 0.85;}
a.prev {background: linear-gradient(to bottom, #1A7BBD 0%, #1A7BBD 50%, #125684 51%, #125684 100%); border-radius: 10px 0 0 10px;}
a.next {background: linear-gradient(to bottom, #D76820 0%, #D76820 50%, #964816 51%, #964816 100%); border-radius: 0 10px 10px 0;}
</style>
> [name=shinya kunisada]
# 【第23回】トラップを改良しよう!
:::success
### 【今回の目標】
- ### トラップを改良しよう!
:::
## ◆ トラップを改良しよう!
### 第21回で、経験値・アイテムトラップを作ったよね!
### 今回はこれをもっと便利に改良していこう!

## ◆ チェストを使おう
### タートルはあまりアイテムを持つことができない。
### だからアイテムをチェストに入れるようにしよう!

:::success
## 【課題1】チェストに入れよう
:::
### タートルの後ろにチェストをおいて、その中に拾ったアイテムを入れるようにしよう!<br><br>
### こうげきするための命令は<span class="focus">turtle.attack()</span>だったね!<br><br>
### チェストにアイテムを入れるために使う命令は<span class="focus">turtle.drop()命令</span>を使うよ!<br><br>
### ただし、<span class="focus">turtle.drop()命令</span>は今選んでいるスロットのアイテムを入れるから、<span class="focus">turtle.select()命令</span>も合わせて使おう!
## ◆ あんまり効率よくない...
### アイテムを拾うたびに振り向いてしまって、アイテムを集める効率があまりよくないね

:::success
## 【課題2】タイミングを調節しよう!
:::
### 効率よくするために、アイテムを30個とったらチェストに入れるように改良してみよう!

### アイテムの個数を調べる方法は<br><br>
### <span class="focus">turtle.getItemDetail(スロット番号)</span>
### または
### <span class="focus">turtle.getItemCount(スロット番号)</span><br><br>
### の2つの命令のどちらでも大丈夫だよ!
### 好きな方・使いやすい方を選ぼう!
## ◆ もっと効率よく!
### これでさっきよりも効率が良くなったかな?
### 他にも効率の良い方法がないか考えてみよう!

<div class="link-box">
<a href="https://hackmd.io/tbdqeB5GQL6YYsPPzGPhiA" class="link prev">前に戻る</a>
<a href="https://hackmd.io/td7UhtlnQWSkePIMKUYXmQ" class="link next">次に進む</a>
</div>