# 天気を変える（gameplay.setWeather）

> 現在の天気を変更します。

- カテゴリ：ゲームプレイ（gameplay）
- ブロック：現在の天気を 晴れ にする
- URL：https://makecode.minecraft-okinawa.com/reference/gameplay/set-weather/
- Pythonでの名前：gameplay.set_weather
- 公式データ取得日：2026-11-13
- 動作確認：確認待ち

## JavaScript

```javascript
gameplay.setWeather(Weather.Clear)
```

## Python

```python
gameplay.set_weather(CLEAR)
```

## 引数

| 名前 | 値 | 意味 |
|---|---|---|
| weather | 数値 | 目的の天気。たとえば：Weather.Clear |

## 使用例

### Bring on a thunderstorm with just a command.

```javascript
player.onChat("storm", function {
    gameplay.setWeather(Weather.Thunder)
});
```

```python
def on_on_chat():
    gameplay.set_weather(THUNDER)
player.on_chat("storm", on_on_chat)
```

## 出典

- [MakeCode for Minecraft 公式リファレンス（gameplay.setWeather）](https://minecraft.makecode.com/reference/gameplay/set-weather)

執筆：鈴木孝昌（現役プロジェクトマネージャー／マイクラカップ指導者）／運営：沖縄マイクラ部 プログラミングスクール「クロスウェーブ」（https://minecraft-okinawa.com/）