Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
テンションも揚げてこう! Ebitengine開発
Search
lapis2411
September 23, 2023
Technology
3.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
テンションも揚げてこう! Ebitengine開発
https://gocon.connpass.com/event/292391/
の登壇資料です。
lapis2411
September 23, 2023
More Decks by lapis2411
See All by lapis2411
イケてるボタンを考える
lapis2411
0
660
WASMで画像生成するためにデータを受け渡す
lapis2411
0
95
Other Decks in Technology
See All in Technology
Reactの設計論
uhyo
12
4.9k
Snowflakeで実現する全社横断の顧客の声(VOC)分析・活用基盤@Snowflake World Tour Tokyo 2026
yuto16
0
120
Tab5をRubyで動くパソコンにする
kishima
2
280
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
290
#jawssonic2026 あの時代が悪かった ~動かなかったSageMakerと共に迎えたイベント当日~
ktkn1129
0
140
ペアプロの価値はコードを書くことだけじゃない
codmoninc
PRO
0
150
enechainの内製セルフサービスプラットフォーム
hiyosi
0
150
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
3
210
深夜のクラウド懺悔室 1:29:300 or 1:0:0
kazzpapa3
1
220
『止めない』を設計する — 制約の中で、事業の根幹を支える判断
hiroyaterui
0
240
Omarchy Quattro の日本語設定周り
simosako
2
110
AIとペアプロを始める。人とのペアプロをやめる。ペアプロの良さを改めて知る。もっと好きになった。 / Rediscovering Pair Programming
honyanya
1
310
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
Leo the Paperboy
mayatellez
8
2.2k
GraphQLとの向き合い方2022年版
quramy
50
15k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
580
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
680
Designing for Timeless Needs
cassininazir
1
470
Marketing to machines
jonoalderson
1
5.8k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
520
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
4
600
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.2k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Transcript
テンションも揚げてこう! Ebitengine開発
自己紹介 藤原健(lapis2411) ・大学時代 - DXライブラリ(C++)を使ったゲーム開発 ・社会人 - 車載組込開発(3年) - 機械設計&検査ソフト開発(2年)
- ブラウザゲームバックエンド(1年) ・趣味 - ボードゲーム Splendor 1000戦 アルナックが好き Dice × Dice Politicsという ボドゲを製作
ゲーム開発してテンションが上がることといえば? イケてるイラスト? めちゃ面白い企画? いい音楽? 最高のチームメンバー?
ゲーム開発してテンションが上がることといえば? もちろんこれもテンション上がるけど ゲームパッド使えたらゲームしてる感がでて テンションが上がらないですか?
ゲーム開発してテンションが上がることといえば? それEbitenengineなら簡単にできます!
実装サンプル
コード実装の説明 func (g *GamepadInput) Update() { if inpututil.IsGamepadButtonJustPressed(0, ebiten.GamepadButton0) {
// Aボタンが押された時の処理 } if ebiten.IsGamepadButtonPressed(0, ebiten.GamepadButton1) { // Bボタンが押されている時の処理 } if inpututil.IsGamepadButtonJustPressed(0, ebiten.GamepadButton7) { //startボタン押下時の処理 } // 左コントロールスティックの入力量を取得 av := ebiten.GamepadAxisValue(0, 0) g.axisValue = 0 // デフォルトで微妙に倒れるので最小感度を設定 if av < -0.3 || av > 0.3 { // 最小感度以上スティックが倒れた時の処理 } } type GamepadInput struct { jump bool fastDrop bool axisValue float64 pause bool }
コード実装の説明 func IsGamepadButtonJustPressed(id ebiten.GamepadID, button ebiten.GamepadButton) bool func IsGamepadButtonJustReleased(id ebiten.GamepadID,
button ebiten.GamepadButton) bool ゲームパッドのボタン入力監視 IsGamepadButtonJustPressed → 現在のTickでボタンが押下されたかどうか IsGamepadButtonJustReleased → 現在のTickでボタンが解放されたかどうか ボタンの状態が変わった瞬間のみ動作させたい →メニューの決定、ジャンプ inpututil パッケージ
コード実装の説明 func IsGamepadButtonPressed(id GamepadID, button GamepadButton) bool ゲームパッドのボタン入力監視 IsGamepadButtonPressed →
現在ボタンが押下されたかどうか (その瞬間の状態がどうか) ボタンが押されている間(もしくは放されている間)動作させたい →ホバリング(ボタンが押されている間は少しずつ上昇、とか ) サンプルではBボタンが押されている間落下速度の上限が上がる ebiten パッケージ
コード実装の説明 func GamepadAxisValue(id GamepadID, axis int) float64 ゲームパッドのスティック入力監視 GamepadAxisValue →
スティックの倒し具合を-1.0~1.0の間で返す axis 0:左スティックX軸方向 1: 左スティックY軸方向 スティックの倒し具合に応じて何かしらの処理をしたい → 移動、メニューセレクト ebiten パッケージ
まとめ • Ebitengine では関数呼び出しで簡単にゲームパッド入力が受け取れる • 今回はサンプルで動けばいいやの実装なので、 ゲームパッドが複数入力された場合にどうするか、 抜き差しされた場合にどうするか、みたいな部分は別途考慮が必要 → 公式のサンプル見たほうが早い
https://ebitengine.org/ja/examples/gamepad.html • PCゲームとしてのリリースを考えるなら入力周りの設計は工夫が必要 • 一応今回のコードは以下で公開してます https://github.com/lapis2411/ebitengine-game
まとめ テンションも揚げ揚げでゲーム開発しよう!