Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Web Programming - Lesson 4
Search
Ryan Chung
April 10, 2020
Technology
0
660
Web Programming - Lesson 4
Ryan Chung
April 10, 2020
Tweet
Share
More Decks by Ryan Chung
See All by Ryan Chung
MovieBot Development
ryan403
0
320
Design Voice-First Games for Alexa
ryan403
0
78
AI Teaching Talk
ryan403
0
140
Cognitive Service
ryan403
0
110
jQuery & API Practices
ryan403
0
150
CSS Practices
ryan403
1
170
JavaScript Practices
ryan403
0
110
Web Programming - Lesson 6
ryan403
1
650
Web Programming - Lesson 7
ryan403
1
650
Other Decks in Technology
See All in Technology
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
43k
【2026年版】生成AIによる情報システムへのインパクト
taka_aki
0
190
大規模な組織におけるAI Agent活用の促進と課題
lycorptech_jp
PRO
5
7.2k
APMの世界から見るOpenTelemetryのTraceの世界 / OpenTelemetry in the Java
soudai
PRO
0
210
AIエージェントで変わる開発プロセス ― レビューボトルネックからの脱却
lycorptech_jp
PRO
2
810
dbt meetup #19 『dbtを『なんとなく動かす』を卒業します』
tiltmax3
0
130
opsmethod第1回_アラート調査の自動化にむけて
yamatook
0
330
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
AWS Bedrock Guardrails / 機密情報の入力・出力をブロックする — Blocking Sensitive Information Input/Output
kazuhitonakayama
2
180
俺の失敗を乗り越えろ!メーカーの開発現場での失敗談と乗り越え方 ~ゆるゆるチームリーダー編~
spiddle
0
420
[続・営業向け 誰でも話せるOCI セールストーク] AWSよりOCIの優位性が分からない編(2026年2月20日開催)
oracle4engineer
PRO
0
150
【SLO】"多様な期待値" と向き合ってみた
z63d
2
270
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
1.1k
The untapped power of vector embeddings
frankvandijk
2
1.6k
Marketing to machines
jonoalderson
1
5k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
860
Code Reviewing Like a Champion
maltzj
527
40k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
64
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
140
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
89
How to build a perfect <img>
jonoalderson
1
5.2k
So, you think you're a good person
axbom
PRO
2
1.9k
Transcript
Web Programming –
[email protected]
行動開發學院 行動開發學院 JavaScript Lab RPG極簡雛形製作 Ryan
Chung 76
Web Programming –
[email protected]
行動開發學院 行動開發學院 需求 • 做一個九宮格可以移動的遊戲雛形 •
可以移動主角,但不會走出範圍 • 可以判斷遇到人、障礙物 • 可以判斷走到終點 • 主角的圖案跟方向一致 77
Web Programming –
[email protected]
行動開發學院 行動開發學院 檔案 • index.html:主要顯示頁面 •
main.js:主要程式運作 • style.css:網頁樣式檔 • images:存放圖片的資料夾 (https://ppt.cc/fN2Eox) 78
Web Programming –
[email protected]
行動開發學院 行動開發學院 index.html • 標題、canvas、div、p 79
Web Programming –
[email protected]
行動開發學院 行動開發學院 style.css 80
Web Programming –
[email protected]
行動開發學院 行動開發學院 main.js • 全域變數宣告、事件觸發 81
Web Programming –
[email protected]
行動開發學院 行動開發學院 main.js • 設定地形、擺上主角 82
Web Programming –
[email protected]
行動開發學院 行動開發學院 main.js • 擺上障礙物、敵人 83
Web Programming –
[email protected]
行動開發學院 行動開發學院 編號與座標的對應 0 1 2
3 4 5 6 7 8 (0,0) (200,0) (400,0) (0,200) (0,400) (200,200) (200,400) (400,200) (400,400) 84
Web Programming –
[email protected]
行動開發學院 行動開發學院 main.js 85 • 按鍵判斷
• 座標設定 • 排除其他狀況
Web Programming –
[email protected]
行動開發學院 行動開發學院 main.js • 判斷目標位置是否在邊界內 •
判斷目標位置是否有障礙物/敵人 86
Web Programming –
[email protected]
行動開發學院 行動開發學院 main.js • 依據目標位置內容,顯示提示訊息於下方 87
Web Programming –
[email protected]
行動開發學院 行動開發學院 總算完成!進行測試 • 主角是否會走出邊界? •
是否遇到障礙物、敵人會無法走,並出現訊息 • 是否有判斷抵達終點? • 是否有依方向轉頭? 88
Web Programming –
[email protected]
行動開發學院 行動開發學院 Recap • HTML –canvas、div、id
• JavaScript –image load、canvas draw image、cut image –for ... in、array、switch –keydown、preventDefault • 資料檔案 –圖片 89
Web Programming –
[email protected]
行動開發學院 行動開發學院 Lab • 可以16 x
16嗎? • 一個物品可以跨越多格嗎? • 如何寫出小精靈? • 如何寫出OOXX遊戲? • 加一顆按鈕攻擊敵人 90