2026-07-09 23:00:00

詰将棋でリアルタイム対戦できる無料オンラインゲーム「詰将棋アリーナ」を作りました

詰将棋をリアルタイムで対戦できる無料のオンラインゲーム「詰将棋アリーナ」を開発してリリースしました。

出題される実戦詰将棋を、相手と同時に解き始めて、解く速さと正確さでスコアを競い合うゲームです。

この記事では、詰将棋アリーナのゲーム内容や特徴、開発に使った技術について紹介します。

▼詰将棋アリーナはこちらから遊べます。アプリのインストールは不要で、PC・スマホのブラウザからすぐにプレイできます。

詰将棋アリーナ - 今すぐプレイ

▼ゲームの詳しい情報は公式サイトにまとめています。

詰将棋アリーナ 公式サイト

目次

詰将棋アリーナとは

詰将棋アリーナは、詰将棋を解く速さと正確さで競う、リアルタイム対戦型のオンライン詰将棋ゲームです。

対戦相手と同じ詰将棋の問題が同時に出題され、制限時間内にどれだけ速く・正確に解けるかでスコアを競います。

将棋のオンライン対戦サービスはたくさんありますが、詰将棋アリーナをリリースした2026年3月の時点では、「詰将棋」を対戦形式で遊べるサービスはほとんどありませんでした。

ちなみにその後、2026年6月には将棋ウォーズにも、詰将棋の早解きで対戦する新モード「詰めバト」が登場しました。詰将棋アリーナのリリースはその3ヶ月前。「詰将棋のリアルタイム対戦」を一足先に形にしていたのは、ちょっとした自慢です。大手からも同じコンセプトのモードが出てくるあたり、この方向性は間違っていなかったのかなと思っています。

一人で黙々と解くイメージの強い詰将棋も、対戦形式になると「相手より先に解きたい」という緊張感が加わって、まったく別の楽しさになります。

詰将棋アリーナの特徴をまとめるとこんな感じです。

  • 実戦詰将棋をリアルタイムで対戦する新感覚のオンラインゲーム
  • アプリのインストール不要。PC・スマホ・タブレットのブラウザですぐ遊べる
  • 完全無料。ゲームの勝敗に影響する課金要素(Pay to Win)は一切なし
  • Googleアカウントかゲストアカウントで手軽に始められる

4つの対戦モードとソロモード

詰将棋アリーナには、4つの対戦モードと、一人で遊べるソロモードがあります。

1v1対戦

制限時間120秒で詰将棋を解き続ける、1対1のスコアバトルです。

対戦結果に応じてEloレーティングが変動するので、自分の実力が数字で可視化されます。

バトルロイヤル

最大12人の大人数で競うスコアレースです。

次々と出題される実戦詰将棋を解いて、参加者の中での最高スコアを目指します。

このモードはテトリス99をイメージして作りました。1対1の真剣勝負とはまた違う、大人数でワイワイ競える楽しさがあります。

早解きバトル

最大5人で同じ問題に挑む10ラウンド制のモードです。

各ラウンドで最速正解者だけが得点できる、一瞬の閃きが勝負を決めるモードです。

遊んだ感覚としては早押しクイズに近く、「先に解けた!」の瞬間の気持ちよさは4モードの中でも随一だと思います。

詰将棋アリーナは配信や動画投稿もガイドラインの範囲内で自由にできるので、例えば配信者さん同士の早解き対決のような企画に使ってもらえたら、観ていても盛り上がって楽しいんじゃないかなと思っています。

プライベートマッチ

合言葉を共有して、特定の友達やコミュニティ仲間だけで集まれるルーム機能です。

将棋仲間との腕試しや、コミュニティのイベントなどにも使えます。

ソロモード

対戦だけでなく、一人でじっくり詰将棋に取り組めるソロモードも用意しています。

ソロモードにもランキングがあるので、マイペースに解きながら自分のスコアを全国のプレイヤーと競えます。

詰将棋アリーナの特徴

実戦詰将棋を採用

詰将棋アリーナで出題されるのは「実戦詰将棋」です。

パズルとしての詰将棋とは違い、必ずしも最短手数で詰ます必要はなく、玉が詰む手順であれば正解になります。

実戦の終盤と同じ感覚で「とにかく詰ます」ことを目指すので、将棋の終盤力を鍛える練習としても効果的だと思います。

Eloレーティングと段位システム

対戦結果に応じて変動するEloレーティングと、10級から8段までの段位システムで実力が可視化されます。

段位はレーティングに応じて振り分けられるので、対戦を重ねてレートを上げていけば、段位も上がっていきます。

マッチングは近い実力の相手と組まれるので、将棋初心者の方から有段者の方まで、それぞれのレベルで楽しめます。

完全無料で遊べる

すべてのゲームモードを無料でプレイできます。

盤や駒などの見た目のカスタマイズアイテムもゲーム内通貨で入手できるので、課金でゲームが有利になる要素は一切ありません。

純粋に詰将棋の実力だけで競える、フェアな対戦環境を目指しました。

盤や駒のカスタマイズ

盤や駒のデザインを自分好みにカスタマイズできます。

対局を重ねて集めたゲーム内通貨で、お気に入りの盤駒を揃えていく楽しみもあります。

詳細な統計で実力を可視化

対戦成績、正解率、平均解答時間など、自分のプレイデータを詳細な統計画面で確認できます。

どの手数の問題が苦手か、といった弱点の分析にも使えるので、上達に役立ちます。

世界観とキャラクター

詰将棋アリーナの舞台は、デジタル空間に浮かぶ「詰代神社」。

日本の神社文化とeスポーツが融合した世界観で、対局を盛り上げるキャラクターたちも登場します。

  • 詰め子: プレイヤーを案内してくれる公式マスコット。黒髪に飛車のヘアクリップがトレードマーク
  • 火鈴 ヒナタ: 情熱的で負けず嫌いなムードメーカー
  • 白妙 ルリ: 冷静沈着な知性派
  • 宵闘 ミカゲ: ミステリアスで掴めない存在

キャラクターのスタンプを対局中に送り合えるので、対戦もほどよくにぎやかです。

開発の経緯

私は趣味で将棋を指していて、これまでも将棋くっつきんぐなど、将棋をテーマにしたゲームを作ってきました。

今回も何か将棋に関するものを作りたいと思い、最初は将棋ウォーズのような対局プラットフォームを作ることも考えました。

ただ、既にあるものと同じようなものを作ってもあまり面白くないので、どうせなら今までになかったものを作りたいと思っていました。

そこで考えたのが、「対戦型の詰将棋」と「ソシャゲ型の詰将棋」という2つのアイデアです。

ソシャゲ型の詰将棋は、パズドラのように敵が詰将棋を出題してきて、それを解いて敵を倒しながら進んでいく、というイメージでした。

ところが調べてみると、「将棋RPG つめつめロード」という、まさにこのアイデアそのもののゲームが既に存在していました。(すでにサービス終了しているようですが…)

ソシャゲ型の詰将棋は既にあった、というわけで、もう一つのアイデアだった対戦型の詰将棋を作ることにしました。

「詰将棋を解く」というソロの遊びを、eスポーツのようなリアルタイム対戦に進化させる。これが詰将棋アリーナのコンセプトです。

使っている技術

技術的には、フロントエンドからバックエンドまでWebの技術スタックで構築しています。

  • フロントエンド: Nuxt 4 (Vue 3) + TypeScript
  • UI: Nuxt UI (Tailwind CSS)
  • バックエンド: Firebase (Authentication / Firestore / Cloud Functions)
  • リアルタイム対戦: Firestoreのリアルタイムリスナーで対戦相手のスコアや進行状況を同期
  • 将棋ロジック: 外部ライブラリを使わず自作 (合法手生成、詰み判定、詰将棋ソルバー)

詰将棋の解答判定は、クライアント側の詰将棋ソルバーで玉方の応手を自動生成しつつ、解答した手順はCloud Functionsでサーバー側でも検証する、というハイブリッド構成にしています。

このあたりの実装の詳細は、また別の記事で紹介したいと思います。

まとめ

詰将棋をリアルタイムで対戦できる無料オンラインゲーム「詰将棋アリーナ」を紹介しました。

  • 実戦詰将棋を解く速さと正確さで競うリアルタイム対戦ゲーム
  • 1v1対戦・バトルロイヤル・早解きバトル・プライベートマッチの4つの対戦モード + ソロモード
  • Eloレーティングと10級〜8段の段位システムで実力を可視化
  • 完全無料、インストール不要でブラウザからすぐ遊べる

将棋が好きな方、詰将棋で腕試しをしてみたい方は、ぜひ一度遊んでみてください。

▼詰将棋アリーナはこちらから無料でプレイできます

詰将棋アリーナ - 今すぐプレイ

▼ゲームの詳しい情報・遊び方は公式サイトをご覧ください

2025-06-03 22:30:00

Vtuber必見 配信画面にリアルタイムにチャンネル登録者数を表示する方法! コピペで使える 無料 CSSも公開!

配信をしていると、普段の配信や、登録者耐久など配信画面上に現在の登録者数を表示したときありますよね。 今回は、OBSの配信画面上にYouTubeのチャンネル登録者数をリアルタイムで表示する方法を紹介します。

この方法を使えば、配信中にリアルタイムで変化するチャンネル登録者数を視聴者と一緒に確認できるようになります。 さらに、CSSを使って表示をカスタマイズする方法も紹介するので、 自分の配信スタイルに合わせたデザインにすることも可能です。

目次

チャンネル登録者数を表示するメリット

配信画面にチャンネル登録者数を表示することには、以下のようなメリットがあります:

  • 視聴者と一緒にマイルストーン(100人、1000人など)を祝うことができる
  • チャンネル登録を促進する効果がある
  • 配信に動きのある要素が加わり、視覚的な魅力が増す
  • 登録者数の変化が見えることでモチベーションアップにつながる

OBSでチャンネル登録者数を表示する方法

Step 1: YouTube Studioからアナリティクスページを開く

  1. YouTube Studioにログインします
  2. 左側のメニューから「アナリティクス」をクリックします
  3. 「現在の登録者数」をクリックします
  4. このページのURLをコピーしておきます(後でOBSで使用します)

Step 2: OBSにブラウザソースを追加する

  1. OBS Studioを開きます
  2. シーンを選択し、「ソース」セクションの「+」ボタンをクリックします
  3. 「ブラウザ」を選択し、名前を「YouTube登録者数」などわかりやすい名前にします
  4. 以下の設定を行います:
  • URL: Step 1でコピーしたYouTube Studioのアナリティクスページのアドレス
  • 幅: 800(必要に応じて調整)
  • 高さ: 600(必要に応じて調整)

この時点のプレビューではまだうまく表示されてなくてかまいません

Step 3: ログインして表示を確認する

  1. ブラウザソースを選択して、「対話(操作)」を選択します
  2. 画面にはGoogleのログイン画面や、アカウント選択画面などが表示されていると思うので、表示されたブラウザウィンドウでYouTubeアカウントにログインします
  3. ログイン後、YoutubeStudioのページでStep 1 と同様の手順で、一度OBSの対話ブラウザ内で登録者数情報のページまで表示してください
  4. ログイン後、OBS画面上で「再読み込み」を押します
  5. これでチャンネル登録者数のリアルタイムの表示ページががOBS上に表示されるようになります

あとは登録差数の数字の部分をOBS側でトリムして載せるのでもいいのですが、 今回はCSSでデザインを変えてよりおしゃれにしていく方法を 紹介します

CSSでカスタマイズする方法

デフォルトの表示ではYouTube Studioの画面全体が表示されてしまいますが、CSSを使って必要な部分だけを表示し、デザインをカスタマイズすることができます。

ブラウザソースのプロパティを開き、「カスタムCSS」欄に以下のコードを貼り付けることで表示をカスタマイズできます。

今回公開しているCSSの一覧はこんな感じです。

おしゃれなデザインがたくさん!

ハートモチーフ

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}


yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}




.counter-symbol {
  display: inline-block;
  animation: waveSymbol 1.5s ease-in-out infinite;
}


.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.1s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.2s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.4s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.5s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 0.6s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 0.7s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 0.8s; }
.counter-symbol:nth-of-type(10) { animation-delay: 0.9s; }
.counter-symbol:nth-of-type(11) { animation-delay: 1.0s; }
.counter-symbol:nth-of-type(12) { animation-delay: 1.1s; }

@keyframes waveSymbol {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.1);
  }
}



yta-smooth-counter > #counter {
  font-size: 48px;
  color: #ffffff;
  background: linear-gradient(270deg, #f48fb1, #b39ddb, #81d4fa, #f48fb1);
  background-size: 800% 800%;
  border: 4px solid #ffffffaa;
  border-radius: 20px;
  padding: 18px 32px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 15px #ffffff88;
  animation: waveBg 8s ease infinite;
}

yta-smooth-counter > #counter::before {
  content: "💖";
  font-size: 46px;
  animation: floatHeart 2s ease-in-out infinite;
}

@keyframes waveBg {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes floatHeart {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

きらきら星モチーフ、アニメーション

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}


yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}




.counter-symbol {
  display: inline-block;
  animation: waveSymbol 1.5s ease-in-out infinite;
}


.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.1s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.2s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.4s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.5s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 0.6s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 0.7s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 0.8s; }
.counter-symbol:nth-of-type(10) { animation-delay: 0.9s; }
.counter-symbol:nth-of-type(11) { animation-delay: 1.0s; }
.counter-symbol:nth-of-type(12) { animation-delay: 1.1s; }

@keyframes waveSymbol {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.1);
  }
}

yta-smooth-counter > #counter {
  font-size: 52px;
  color: #fff8dc;
  background: linear-gradient(135deg, #d6bfbc, #b5cccf);
  border: 3px solid #ffd700;
  border-radius: 24px;
  padding: 20px 36px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 0 20px #ffe57f, 0 0 30px #ffd700;
  animation: glowStar 2s ease-in-out infinite;
}

yta-smooth-counter > #counter::before {
  content: "🌟";
  font-size: 48px;
  animation: spinStar 6s linear infinite;
}

@keyframes glowStar {
  0%, 100% { box-shadow: 0 0 20px #ffe57f, 0 0 30px #ffd700; }
  50% { box-shadow: 0 0 30px #ffecb3, 0 0 45px #ffff8d; }
}

@keyframes spinStar {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

さくらモチーフ

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}


yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}




.counter-symbol {
  display: inline-block;
  animation: waveSymbol 1.5s ease-in-out infinite;
}


.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.1s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.2s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.4s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.5s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 0.6s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 0.7s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 0.8s; }
.counter-symbol:nth-of-type(10) { animation-delay: 0.9s; }
.counter-symbol:nth-of-type(11) { animation-delay: 1.0s; }
.counter-symbol:nth-of-type(12) { animation-delay: 1.1s; }

@keyframes waveSymbol {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.1);
  }
}

yta-smooth-counter > #counter {
  font-size: 48px;
  color: #ba68c8;
  background: rgba(255, 248, 252, 0.95);
  border: 2px solid #f8bbd0;
  border-radius: 12px;
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 8px rgba(186, 104, 200, 0.2);
}

yta-smooth-counter > #counter::before {
  content: "🌸";
  font-size: 36px;
}

レトロゲーム風

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}


yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}




.counter-symbol {
  display: inline-block;
  animation: waveSymbol 1.5s ease-in-out infinite;
}


.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.1s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.2s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.4s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.5s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 0.6s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 0.7s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 0.8s; }
.counter-symbol:nth-of-type(10) { animation-delay: 0.9s; }
.counter-symbol:nth-of-type(11) { animation-delay: 1.0s; }
.counter-symbol:nth-of-type(12) { animation-delay: 1.1s; }

@keyframes waveSymbol {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.1);
  }
}


yta-smooth-counter > #counter {
  font-family: 'Press Start 2P', monospace; 
  font-size: 32px;
  color: #00e5ff;
  background: #000000dd;
  border: 3px dashed #00e5ff;
  border-radius: 12px;
  padding: 14px 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 10px #00e5ff, 0 0 20px #00e5ff88;
  animation: pulseGlow 1.5s infinite ease-in-out;
}

yta-smooth-counter > #counter::before {
  content: "👾";
  font-size: 36px;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px #00e5ff; }
  50% { box-shadow: 0 0 20px #00ffff88; }
}

ゆるふわ、動物系(くまちゃん)

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}


yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}




.counter-symbol {
  display: inline-block;
  animation: waveSymbol 1.5s ease-in-out infinite;
}


.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.1s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.2s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.4s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.5s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 0.6s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 0.7s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 0.8s; }
.counter-symbol:nth-of-type(10) { animation-delay: 0.9s; }
.counter-symbol:nth-of-type(11) { animation-delay: 1.0s; }
.counter-symbol:nth-of-type(12) { animation-delay: 1.1s; }

@keyframes waveSymbol {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.1);
  }
}

yta-smooth-counter > #counter {
  font-size: 48px;
  color: #6d4c41;
  background: rgba(255, 248, 225, 0.9);
  border: 3px solid #ffe0b2;
  border-radius: 30px;
  padding: 18px 28px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 10px rgba(255, 204, 128, 0.4);
}

yta-smooth-counter > #counter::before {
  content: "🐻";
  font-size: 40px;
}

おやすみムーン

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}


yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}




.counter-symbol {
  display: inline-block;
  animation: waveSymbol 1.5s ease-in-out infinite;
}


.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.1s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.2s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.4s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.5s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 0.6s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 0.7s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 0.8s; }
.counter-symbol:nth-of-type(10) { animation-delay: 0.9s; }
.counter-symbol:nth-of-type(11) { animation-delay: 1.0s; }
.counter-symbol:nth-of-type(12) { animation-delay: 1.1s; }

@keyframes waveSymbol {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.1);
  }
}

yta-smooth-counter > #counter {
  font-size: 48px;
  color: #9575cd;
  background: rgba(235, 222, 255, 0.9);
  border: 2px solid #b39ddb;
  border-radius: 30px;
  padding: 18px 30px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 20px #d1c4e9;
  animation: moonFloat 3s ease-in-out infinite;
}

yta-smooth-counter > #counter::before {
  content: "🌙";
  font-size: 44px;
  animation: moonGlow 2s ease-in-out infinite;
}

@keyframes moonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes moonGlow {
  0%, 100% { text-shadow: 0 0 6px #b39ddb; }
  50% { text-shadow: 0 0 12px #b39ddb; }
}

アニメ風ポップ、かわいい系

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}

yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}

.counter-symbol {
  display: inline-block;
  animation: animeJump 1.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.1s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.2s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.4s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.5s; }

@keyframes animeJump {
  0%, 100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) scale(1.3) rotate(10deg);
  }
}

yta-smooth-counter > #counter {
  font-size: 54px;
  font-weight: 900;
  color: #ff1493;
  background: linear-gradient(135deg, #ffb3e6, #ffe6f7);
  border: 4px solid #ff69b4;
  border-radius: 35px;
  padding: 25px 40px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  box-shadow: 
    0 8px 0 #d1477a,
    0 12px 20px rgba(255, 20, 147, 0.4);
  animation: animeWobble 2s ease-in-out infinite;
  position: relative;
}

yta-smooth-counter > #counter::before {
  content: "🎀";
  font-size: 48px;
  animation: ribbonDance 3s ease-in-out infinite;
}

yta-smooth-counter > #counter::after {
  content: "💕";
  position: absolute;
  top: -25px;
  right: -15px;
  font-size: 30px;
  animation: heartFloat 2.5s ease-in-out infinite;
}

@keyframes animeWobble {
  0%, 100% { 
    transform: rotate(0deg) scale(1);
    box-shadow: 0 8px 0 #d1477a, 0 12px 20px rgba(255, 20, 147, 0.4);
  }
  25% { 
    transform: rotate(1deg) scale(1.02);
    box-shadow: 0 10px 0 #d1477a, 0 15px 25px rgba(255, 20, 147, 0.5);
  }
  50% { 
    transform: rotate(0deg) scale(1.03);
    box-shadow: 0 6px 0 #d1477a, 0 10px 15px rgba(255, 20, 147, 0.3);
  }
  75% { 
    transform: rotate(-1deg) scale(1.02);
    box-shadow: 0 10px 0 #d1477a, 0 15px 25px rgba(255, 20, 147, 0.5);
  }
}

@keyframes ribbonDance {
  0%, 100% { transform: rotate(0deg) scale(1); }
  33% { transform: rotate(15deg) scale(1.1); }
  66% { transform: rotate(-10deg) scale(0.95); }
}

@keyframes heartFloat {
  0%, 100% { 
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% { 
    transform: translateY(-10px) scale(1.2);
    opacity: 0.8;
  }
}

海中モチーフ、おさかな

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}

yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}

.counter-symbol {
  display: inline-block;
  animation: underwaterSway 2.8s ease-in-out infinite;
}

.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.23s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.46s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.69s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.92s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 1.15s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 1.38s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 1.61s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 1.84s; }
.counter-symbol:nth-of-type(10) { animation-delay: 2.07s; }
.counter-symbol:nth-of-type(11) { animation-delay: 2.30s; }
.counter-symbol:nth-of-type(12) { animation-delay: 2.53s; }

@keyframes underwaterSway {
  0%, 100% {
    transform: translateX(0) translateY(0) rotate(0deg);
    filter: hue-rotate(0deg);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 8px rgba(255, 255, 255, 0.8);
  }
  25% {
    transform: translateX(4px) translateY(-3px) rotate(1deg);
    filter: hue-rotate(90deg);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 10px rgba(255, 255, 255, 0.9);
  }
  50% {
    transform: translateX(0) translateY(-6px) rotate(0deg);
    filter: hue-rotate(180deg);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 12px rgba(255, 255, 255, 1);
  }
  75% {
    transform: translateX(-4px) translateY(-3px) rotate(-1deg);
    filter: hue-rotate(270deg);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 10px rgba(255, 255, 255, 0.9);
  }
}

yta-smooth-counter > #counter {
  font-size: 52px;
  font-weight: bold;
  color: #00ced1;
  background: radial-gradient(ellipse at center,
    rgba(0, 191, 255, 0.2) 0%,
    rgba(0, 206, 209, 0.3) 50%,
    rgba(0, 100, 139, 0.4) 100%);
  border: 3px solid #20b2aa;
  border-radius: 50px;
  padding: 28px 45px;
  display: inline-flex;
  align-items: center;
  gap: 22px;
  box-shadow: 
    0 0 25px rgba(0, 206, 209, 0.6),
    inset 0 0 25px rgba(175, 238, 238, 0.3);
  animation: oceanWave 5s ease-in-out infinite;
  position: relative;
}

yta-smooth-counter > #counter::before {
  content: "🐠";
  font-size: 48px;
  animation: fishSwim 4s ease-in-out infinite;
}

yta-smooth-counter > #counter::after {
  content: "🫧 🫧 🫧";
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  animation: bubbleRise 3s ease-out infinite;
}

@keyframes oceanWave {
  0%, 100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 25px rgba(0, 206, 209, 0.6), inset 0 0 25px rgba(175, 238, 238, 0.3);
  }
  25% {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 0 35px rgba(64, 224, 208, 0.7), inset 0 0 35px rgba(175, 238, 238, 0.4);
  }
  50% {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.6), inset 0 0 30px rgba(224, 255, 255, 0.3);
  }
  75% {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 0 35px rgba(64, 224, 208, 0.7), inset 0 0 35px rgba(175, 238, 238, 0.4);
  }
}

@keyframes fishSwim {
  0%, 100% { transform: translateX(0) scaleX(1); }
  25% { transform: translateX(8px) scaleX(1); }
  50% { transform: translateX(0) scaleX(-1); }
  75% { transform: translateX(-8px) scaleX(-1); }
}

@keyframes bubbleRise {
  0% {
    transform: translateX(-50%) translateY(0) scale(0.5);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(-60px) scale(1.2);
    opacity: 0;
  }
}

ゲーミングフレーム風


html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}

yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}

.counter-symbol {
  display: inline-block;
  animation: retroGlow 1.8s ease-in-out infinite;
}

.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.15s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.45s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.6s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.75s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 0.9s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 1.05s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 1.2s; }
.counter-symbol:nth-of-type(10) { animation-delay: 1.35s; }
.counter-symbol:nth-of-type(11) { animation-delay: 1.5s; }
.counter-symbol:nth-of-type(12) { animation-delay: 1.65s; }

@keyframes retroGlow {
  0%, 100% {
    transform: skewX(0deg);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 5px #ff00ff,
      0 0 10px #ff00ff,
      0 0 15px #00ffff;
  }
  50% {
    transform: skewX(-2deg);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 8px #00ffff,
      0 0 16px #00ffff,
      0 0 24px #ff00ff;
  }
}

yta-smooth-counter > #counter {
  font-family: 'Orbitron', monospace;
  font-size: 54px;
  font-weight: bold;
  color: #ff00ff;
  background: linear-gradient(135deg, 
    rgba(255, 0, 255, 0.1), 
    rgba(0, 255, 255, 0.1), 
    rgba(255, 0, 128, 0.1));
  border: 3px solid;
  border-image: linear-gradient(45deg, #ff00ff, #00ffff) 1;
  border-radius: 0;
  padding: 25px 45px;
  display: inline-flex;
  align-items: center;
  gap: 25px;
  box-shadow: 
    0 0 20px #ff00ff,
    0 0 40px rgba(255, 0, 255, 0.3),
    inset 0 0 20px rgba(0, 255, 255, 0.1);
  animation: retroPulse 3s ease-in-out infinite;
  position: relative;
  transform: perspective(1000px) rotateX(10deg);
}

yta-smooth-counter > #counter::before {
  content: "🕹️";
  font-size: 48px;
  animation: gamepadBounce 2s ease-in-out infinite;
}

yta-smooth-counter > #counter::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 2px,
    rgba(255, 0, 255, 0.1) 2px,
    rgba(255, 0, 255, 0.1) 4px
  );
  pointer-events: none;
  animation: scanlines 0.1s linear infinite;
}

@keyframes retroPulse {
  0%, 100% {
    box-shadow: 
      0 0 20px #ff00ff,
      0 0 40px rgba(255, 0, 255, 0.3),
      inset 0 0 20px rgba(0, 255, 255, 0.1);
    border-image: linear-gradient(45deg, #ff00ff, #00ffff) 1;
  }
  50% {
    box-shadow: 
      0 0 30px #00ffff,
      0 0 60px rgba(0, 255, 255, 0.4),
      inset 0 0 30px rgba(255, 0, 255, 0.2);
    border-image: linear-gradient(45deg, #00ffff, #ff00ff) 1;
  }
}

@keyframes gamepadBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(10deg); }
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

炎モチーフ、ファイアーテーマ

html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body * {
  visibility: hidden !important;
}

yta-smooth-counter > #counter,
yta-smooth-counter > #counter * {
  visibility: visible !important;
}

.counter-symbol {
  display: inline-block;
  animation: fireFlicker 1.2s ease-in-out infinite;
}

.counter-symbol:nth-of-type(1)  { animation-delay: 0s; }
.counter-symbol:nth-of-type(2)  { animation-delay: 0.1s; }
.counter-symbol:nth-of-type(3)  { animation-delay: 0.2s; }
.counter-symbol:nth-of-type(4)  { animation-delay: 0.3s; }
.counter-symbol:nth-of-type(5)  { animation-delay: 0.4s; }
.counter-symbol:nth-of-type(6)  { animation-delay: 0.5s; }
.counter-symbol:nth-of-type(7)  { animation-delay: 0.6s; }
.counter-symbol:nth-of-type(8)  { animation-delay: 0.7s; }
.counter-symbol:nth-of-type(9)  { animation-delay: 0.8s; }
.counter-symbol:nth-of-type(10) { animation-delay: 0.9s; }
.counter-symbol:nth-of-type(11) { animation-delay: 1.0s; }
.counter-symbol:nth-of-type(12) { animation-delay: 1.1s; }

@keyframes fireFlicker {
  0%, 100% {
    transform: translateY(0) scaleY(1);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 5px #ff4500,
      0 0 10px #ff6347,
      0 0 15px #ffa500;
    color: #ff4500;
  }
  25% {
    transform: translateY(-4px) scaleY(1.1);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 8px #ff0000,
      0 0 16px #ff4500,
      0 0 24px #ffa500;
    color: #ff0000;
  }
  50% {
    transform: translateY(-2px) scaleY(0.95);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 6px #ff8c00,
      0 0 12px #ffa500,
      0 0 18px #ffff00;
    color: #ff8c00;
  }
  75% {
    transform: translateY(-6px) scaleY(1.05);
    text-shadow: 
      -2px -2px 0 #ffffff,
      2px -2px 0 #ffffff,
      -2px 2px 0 #ffffff,
      2px 2px 0 #ffffff,
      0 0 10px #ff6347,
      0 0 20px #ff4500,
      0 0 30px #ff0000;
    color: #ff6347;
  }
}

yta-smooth-counter > #counter {
  font-size: 56px;
  font-weight: bold;
  color: #ff4500;
  background: radial-gradient(ellipse at center,
    rgba(255, 69, 0, 0.3) 0%,
    rgba(255, 140, 0, 0.2) 50%,
    rgba(139, 0, 0, 0.4) 100%);
  border: 3px solid #ff6347;
  border-radius: 25px;
  padding: 22px 40px;
  display: inline-flex;
  align-items: center;
  gap: 20px;
  box-shadow: 
    0 0 30px rgba(255, 69, 0, 0.7),
    0 0 50px rgba(255, 140, 0, 0.4),
    inset 0 0 20px rgba(255, 165, 0, 0.2);
  animation: flameIntensity 2s ease-in-out infinite;
  position: relative;
}

yta-smooth-counter > #counter::before {
  content: "🔥";
  font-size: 52px;
  animation: fireDance 1.8s ease-in-out infinite;
}

yta-smooth-counter > #counter::after {
  content: "🔥 💥 🔥";
  position: absolute;
  top: -45px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
  animation: fireStorm 2.5s ease-in-out infinite;
}

@keyframes flameIntensity {
  0%, 100% {
    box-shadow: 
      0 0 30px rgba(255, 69, 0, 0.7),
      0 0 50px rgba(255, 140, 0, 0.4),
      inset 0 0 20px rgba(255, 165, 0, 0.2);
    border-color: #ff6347;
  }
  50% {
    box-shadow: 
      0 0 40px rgba(255, 0, 0, 0.8),
      0 0 70px rgba(255, 69, 0, 0.6),
      inset 0 0 30px rgba(255, 215, 0, 0.3);
    border-color: #ff0000;
  }
}

@keyframes fireDance {
  0%, 100% { 
    transform: rotate(0deg) scale(1); 
    filter: hue-rotate(0deg);
  }
  25% { 
    transform: rotate(5deg) scale(1.1); 
    filter: hue-rotate(15deg);
  }
  50% { 
    transform: rotate(0deg) scale(1.05); 
    filter: hue-rotate(30deg);
  }
  75% { 
    transform: rotate(-5deg) scale(1.1); 
    filter: hue-rotate(15deg);
  }
}

@keyframes fireStorm {
  0%, 100% { 
    transform: translateX(-50%) scale(1);
    opacity: 0.8;
  }
  50% { 
    transform: translateX(-50%) scale(1.2);
    opacity: 1;
  }
}

注意事項

こちらのCSSは自己責任でご利用ください

YouTubeのアップデート等によって表示がうまくいかなくなる可能性もあります

数日たったり、アカウントを切り替えたりすると、ログアウト状態になり表示されなくなることがあります、 その場合は一度CSSをクリアして、OBSの対話画面からYoutubeStudioにログインして、 再読み込みをしてください。

まとめ

OBSでYouTubeのチャンネル登録者数を表示する方法を紹介しました。 CSSを使ったカスタマイズ例も紹介しましたが、自分好みにさらに調整することも可能です。 配信画面に個性を出して、視聴者により楽しんでもらえる配信を目指しましょう!

2024-09-24 18:00:00

【Unity】スイカ風マージパズルゲームの作り方 その3 ~ くっついて進化・消す処理を作る ~【2024年最新】

Unityを使ってスイカ風のマージパズルゲームを作成する方法を解説します。

前回までの記事はこちらです。

【Unity】スイカ風マージパズルゲームの作り方 その1【2024年最新】 - なぎなぎブログ

【Unity】スイカ風マージパズルゲームの作り方 その2 ~ スポナーを作る ~【2024年最新】 - なぎなぎブログ

今回は、駒(ボール)をくっついたときに進化・消す処理を作っていきます。

目次

くっついた(マージした)ときに駒(ボール)消す処理の作成

駒がくっついたときに進化・消す処理を作成します。

駒がくっついたときに進化する条件は下記の通りです。

  • 同じ種類の駒がぶつかったとき
  • 駒が進化可能なとき

駒がくっついたときに消す条件は下記の通りです。

  • 同じ種類の駒がぶつかったとき
  • 駒が進化できないとき

駒が進化できないときというのは、最大まで進化して次の進化がないときです。

つまり今回の将棋をモチーフにしたゲームの場合は、王将と王将がぶつかったときに消えるということです。

駒のスクリプトの修正

先程の条件で、駒を進化または消す処理をスクリプトに記述していきます。

Assets/Scripts/Koma.cs を修正します。

using UnityEngine;

public class Koma : MonoBehaviour
{
    // 駒の種類
    public int Type { get; set; }

    // マージ済みフラグ
    public bool IsMerge { get; set; }

    // 進化可能かどうか
    public bool CanPromote { get; set; }


    // 衝突したときの処理
    private void OnCollisionEnter2D(Collision2D other)
    {
        // 衝突先が駒でない場合は処理を行わない
        var otherKoma = other.gameObject.GetComponent<Koma>();
        if (!otherKoma)
        {
            return;
        }

        // マージ済みの場合は処理を行わない
        if (IsMerge || otherKoma.IsMerge)
        {
            return;
        }

        // 同じタイプの駒出ない場合は処理を行わない
        if (Type != otherKoma.Type)
        {
            return;
        }


        // 衝突元と衝突先で複数回マージ処理が動かないように、マージ済みフラグを立てる
        IsMerge = true;
        otherKoma.IsMerge = true;
        // 2つの駒の中間地点を取得
        var position = Vector2.Lerp(transform.position, other.transform.position, 0.5f);
        // 進化先があれば新しい駒を生成
        if (CanPromote)
        {
            // 2つの駒の中間地点に新しい駒を生成
            KomaFactory.Instance.CreateKoma(position, Type + 1);
        }

        // 衝突した駒を削除
        Destroy(gameObject);
        Destroy(other.gameObject);
    }
}

ソースコードにコメントを書いているので、処理の流れはわかると思います。

1点分かりづらそうな部分の補足として、Vector2.Lerp というメソッドを使って、2つのオブジェクトの中間地点を取得しています。

public static Vector2 Lerp(Vector2 a, Vector2 b, float t); と宣言されていて、 Vector2.Lerpは、ベクトルaとベクトルbの間のtで線形に補間します。

tが0のときはa、tが1のときはb、tが0.5のときはaとbの中間地点を返します。

今回は中点を取得するため、tを0.5にしています。

スクリプトを修正後はの動作は次のような動画のようになります。

まとめ

今回は、駒がくっついたときに進化・消す処理を作成しました。

ゲームのコア部分の動きとしてはほとんど完成しているように思いますね。

次回は、スコアの保持や、ゲームオーバーの処理を作成してきます。