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
670
0
Share
Web Programming - Lesson 4
Ryan Chung
April 10, 2020
More Decks by Ryan Chung
See All by Ryan Chung
MovieBot Development
ryan403
0
320
Design Voice-First Games for Alexa
ryan403
0
80
AI Teaching Talk
ryan403
0
140
Cognitive Service
ryan403
0
110
jQuery & API Practices
ryan403
0
150
CSS Practices
ryan403
1
180
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
AI時代に新卒採用、はじめました/junior-engineer-never-die
dmnlk
0
200
ログ基盤・プラグイン・ダッシュボード、全部整えた。でも最後は人だった。
makikub
4
770
バックオフィスPJのPjMをコーポレートITが担うとうまくいく3つの理由
yueda256
1
290
Autonomous Database - Dedicated 技術詳細 / adb-d_technical_detail_jp
oracle4engineer
PRO
5
13k
Oracle Cloud Infrastructure:2026年3月度サービス・アップデート
oracle4engineer
PRO
0
400
AWS DevOps Agent or Kiro の使いどころを考える_20260402
masakiokuda
0
190
ADOTで始めるサーバレスアーキテクチャのオブザーバビリティ
alchemy1115
2
210
試されDATA SAPPORO [LT]Claude Codeで「ゆっくりデータ分析」
ishikawa_satoru
0
190
組織的なAI活用を阻む 最大のハードルは コンテキストデザインだった
ixbox
1
900
「決め方」の渡し方 / How to hand over the "decision-making process"
pauli
7
1.2k
"まず試す"ためのDatabricks Apps活用法 / Databricks Apps for Early Experiments and Validation
nttcom
1
200
OPENLOGI Company Profile
hr01
0
83k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Everyday Curiosity
cassininazir
0
190
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Side Projects
sachag
455
43k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Between Models and Reality
mayunak
3
260
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
160
A better future with KSS
kneath
240
18k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
160
Evolving SEO for Evolving Search Engines
ryanjones
0
170
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Testing 201, or: Great Expectations
jmmastey
46
8.1k
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