Submit Search
Upload
Android 2D 遊戲設計基礎
•
Download as ODP, PDF
•
0 likes
•
482 views
PingLun Liao
Follow
介紹 Android 2D 遊戲設計的基礎觀念。
Read less
Read more
Technology
Slideshow view
Report
Share
Slideshow view
Report
Share
1 of 29
Download now
Recommended
遊戲易用性研究與測試方法
遊戲易用性研究與測試方法
cheng yeh chang
平板電腦使用經驗初探
平板電腦使用經驗初探
iNSIGHT UXLab
使用性測試方法介紹
使用性測試方法介紹
iNSIGHT UXLab
Google map api接口整理
Google map api接口整理
lileinba
浅析Flash特效开发 陈勇
浅析Flash特效开发 陈勇
FLASH开发者交流会
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
Weizhong Yang
Beyond Android Views - Window,Surface,Special Views,and More
Beyond Android Views - Window,Surface,Special Views,and More
rogeryi
Study mapapi v0.1
Study mapapi v0.1
Paul Yang
Recommended
遊戲易用性研究與測試方法
遊戲易用性研究與測試方法
cheng yeh chang
平板電腦使用經驗初探
平板電腦使用經驗初探
iNSIGHT UXLab
使用性測試方法介紹
使用性測試方法介紹
iNSIGHT UXLab
Google map api接口整理
Google map api接口整理
lileinba
浅析Flash特效开发 陈勇
浅析Flash特效开发 陈勇
FLASH开发者交流会
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
Weizhong Yang
Beyond Android Views - Window,Surface,Special Views,and More
Beyond Android Views - Window,Surface,Special Views,and More
rogeryi
Study mapapi v0.1
Study mapapi v0.1
Paul Yang
Adobe Photoshop CS提示与诀窍
Adobe Photoshop CS提示与诀窍
Chon Seong Hoo
Gtk+陷阱与进阶技巧
Gtk+陷阱与进阶技巧
tuhaihe
App inventor 教學講義 chapter6
App inventor 教學講義 chapter6
Jerry Wu
Customize renderpipeline
Customize renderpipeline
AkilarLiao
Multi Camera Prmandoc
Multi Camera Prmandoc
guestb02e87
一淘新首页总结
一淘新首页总结
jieorlin
06 Subclassing UIView and UIScrollView
06 Subclassing UIView and UIScrollView
Tom Fan
Android layout 工程師在想什麼?給視覺設計師
Android layout 工程師在想什麼?給視覺設計師
Kane Shih
深入探討 C 語言
深入探討 C 語言
PingLun Liao
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹
PingLun Liao
給沒有程式設計經驗的人
給沒有程式設計經驗的人
PingLun Liao
陣列與指標
陣列與指標
PingLun Liao
Perl For Bioinformatics
Perl For Bioinformatics
PingLun Liao
C++ STL 概觀
C++ STL 概觀
PingLun Liao
C++ Function
C++ Function
PingLun Liao
C 檔案輸入與輸出
C 檔案輸入與輸出
PingLun Liao
Win32 視窗程式設計基礎
Win32 視窗程式設計基礎
PingLun Liao
Matlab 在機率與統計的應用
Matlab 在機率與統計的應用
PingLun Liao
Android 介面設計
Android 介面設計
PingLun Liao
Java 視窗程式設計
Java 視窗程式設計
PingLun Liao
Java 網路程式
Java 網路程式
PingLun Liao
Android introduction
Android introduction
PingLun Liao
More Related Content
Similar to Android 2D 遊戲設計基礎
Adobe Photoshop CS提示与诀窍
Adobe Photoshop CS提示与诀窍
Chon Seong Hoo
Gtk+陷阱与进阶技巧
Gtk+陷阱与进阶技巧
tuhaihe
App inventor 教學講義 chapter6
App inventor 教學講義 chapter6
Jerry Wu
Customize renderpipeline
Customize renderpipeline
AkilarLiao
Multi Camera Prmandoc
Multi Camera Prmandoc
guestb02e87
一淘新首页总结
一淘新首页总结
jieorlin
06 Subclassing UIView and UIScrollView
06 Subclassing UIView and UIScrollView
Tom Fan
Android layout 工程師在想什麼?給視覺設計師
Android layout 工程師在想什麼?給視覺設計師
Kane Shih
Similar to Android 2D 遊戲設計基礎
(8)
Adobe Photoshop CS提示与诀窍
Adobe Photoshop CS提示与诀窍
Gtk+陷阱与进阶技巧
Gtk+陷阱与进阶技巧
App inventor 教學講義 chapter6
App inventor 教學講義 chapter6
Customize renderpipeline
Customize renderpipeline
Multi Camera Prmandoc
Multi Camera Prmandoc
一淘新首页总结
一淘新首页总结
06 Subclassing UIView and UIScrollView
06 Subclassing UIView and UIScrollView
Android layout 工程師在想什麼?給視覺設計師
Android layout 工程師在想什麼?給視覺設計師
More from PingLun Liao
深入探討 C 語言
深入探討 C 語言
PingLun Liao
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹
PingLun Liao
給沒有程式設計經驗的人
給沒有程式設計經驗的人
PingLun Liao
陣列與指標
陣列與指標
PingLun Liao
Perl For Bioinformatics
Perl For Bioinformatics
PingLun Liao
C++ STL 概觀
C++ STL 概觀
PingLun Liao
C++ Function
C++ Function
PingLun Liao
C 檔案輸入與輸出
C 檔案輸入與輸出
PingLun Liao
Win32 視窗程式設計基礎
Win32 視窗程式設計基礎
PingLun Liao
Matlab 在機率與統計的應用
Matlab 在機率與統計的應用
PingLun Liao
Android 介面設計
Android 介面設計
PingLun Liao
Java 視窗程式設計
Java 視窗程式設計
PingLun Liao
Java 網路程式
Java 網路程式
PingLun Liao
Android introduction
Android introduction
PingLun Liao
RESTful
RESTful
PingLun Liao
Web service
Web service
PingLun Liao
How toprogram
How toprogram
PingLun Liao
Generic Programming
Generic Programming
PingLun Liao
Object-Oriented Programming
Object-Oriented Programming
PingLun Liao
Object-Based Programming Part II
Object-Based Programming Part II
PingLun Liao
More from PingLun Liao
(20)
深入探討 C 語言
深入探討 C 語言
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹
給沒有程式設計經驗的人
給沒有程式設計經驗的人
陣列與指標
陣列與指標
Perl For Bioinformatics
Perl For Bioinformatics
C++ STL 概觀
C++ STL 概觀
C++ Function
C++ Function
C 檔案輸入與輸出
C 檔案輸入與輸出
Win32 視窗程式設計基礎
Win32 視窗程式設計基礎
Matlab 在機率與統計的應用
Matlab 在機率與統計的應用
Android 介面設計
Android 介面設計
Java 視窗程式設計
Java 視窗程式設計
Java 網路程式
Java 網路程式
Android introduction
Android introduction
RESTful
RESTful
Web service
Web service
How toprogram
How toprogram
Generic Programming
Generic Programming
Object-Oriented Programming
Object-Oriented Programming
Object-Based Programming Part II
Object-Based Programming Part II
Android 2D 遊戲設計基礎
1.
Android 2D Game
2.
Canvas ( 畫布
) 可繪製像素點、直線、圓、矩形等。 Android SDK 提供 View 和 SurfaceView 兩個類別來操作 Canvas 。
3.
在 View 上實現動畫 1.
撰寫繼承 View 的類別 (GameView) 2. 覆寫 View.onDraw 方法。 3. 實現 OnTouchListener 介面。 4. 處理動畫的執行緒。 5. 在 Activity 中建立 GameView 物件。 Example: Game_View
4.
在 SurfaceView 上實現動畫 優點: 1.
可直接獲得 Canvas 。 2. 支援雙緩衝區技術,繪圖效率較高。 3. 可在非 UI 執行緒中直接繪圖。
5.
在 SurfaceView 上實現動畫 步驟: 1.
使用 SurfaceHolder.lockCanvas 取得 Canvas 物件。 2. 清空螢幕時,呼叫 Canvas.drawColor 方法。 3. 呼叫 Canvas 物件的方法繪圖。 4. 使用 SurfaceHolder.unlockCanvasAndPost 方法。 Example: surfaceview
6.
圖形繪製基礎 像素點: drawPoint 、
drawPoints 直線: drawLine 、 drawLines 圓形: drawCircle 弧形: drawArc 文字: drawText 、 drawPosText Example: draw
7.
像素點 (Pixel)
8.
像素點 (Pixel) drawPoint(float x,
float y, Paint paint) 參數說明: X: 像素點的水平座標。 Y: 像素點的垂直座標。 Paint: 描述像素點的 Paint 物件。
9.
直線 (Line) drawLine (float
startX, float startY, float stopX, float stopY, Paint paint) 參數說明: startX :起始點的 X 坐標。 startY :起始點的 Y 坐標。 stopX : 止點的终 X 坐標。 stopY : 止點的终 Y 坐標。 paint :所使用的畫筆。 https://play.google.com/store/apps/details?id=com.bitmango.flowline
10.
圓形 (Circle) DrawCircle(float cx,
float cy, float radius, Paint paint) 參數說明: Cx: 圓心的水平座標。 Cy: 圓心的垂直座標。 Radius: 圓的半徑。
11.
弧形 (Arc) drawArc(RectF oval,
float startAngle, float sweepAngle, boolean useCenter, Paint paint) 參數說明: oval : 指定圓弧的外輪廓矩形區域。 startAngle: 圓弧起始角度,單位為度。 sweepAngle: 圓弧掃過的角度,順時針方向,單位為度。 useCenter: 如果為 True 時,在繪制圓弧時將圓心包括在內,通常用來繪制扇形。 paint: 繪制圓弧的畫板屬性,如顏色,是否填充等。
12.
弧形 (Arc) useCenter=false 填充 userCenter=true 不填充
13.
文字 (Text) drawText (String
text, float x, float y, Paint paint) 參數說明: Text: 要繪製的文字。 X: 文字起始點的水平座標。 Y: 文字起始點的垂直座標。 Paint: 所使用的畫筆。
14.
點陣圖 (Bitmap) 有兩種方法: 1. 直接繪製
Bitmap 物件。 2. 使用 Drawable.draw 方法。 Example: drawbitmap
15.
影像的透明度 (alpha) Android 顏色由
RGBA 所組成,分別為 Red 、 Green 、 Blue 、 Alpha , RGB 為三原色, Alpha 為透明度。 越小,顏色越淡。值 設定透明度可透過 Paint.setAlpha 方法。 Example: alpha
16.
旋轉影像 使用 Matrix.setRotate 方法。 degrees
參數 大於值 0 ,順時針旋轉;小於 0 ,逆時針旋轉 。 Example: rotate_image
17.
路徑 (Path) 透過 Canvas.drawPath
方法建立路徑。 PathEffect 物件建立特效。 CornerPathEffect 、 DashPathEffect 、 PathDashPathEffect 、 ComposePathEffect 。 Example: image_path
18.
Shader 著色效果 BitmapShader :將影像按橢圓或弧形繪製。 LinearGradient
:線性漸層。 RadialGradient :徑向漸層。 SweepGradient :角度漸層 ( 光源效果 ) 。 ComposeShader :混合著色。 Example: shader
19.
框 (Frame) 動畫 由許多影像所組成的動畫,影像以一定的時間間隔切換。電影的播放頻 率為每秒
25 框。 1. 產生 XML 格式,在檔 res/anim 底下。 2. 建立 AnimationDrawable 物件。 Example: frame
20.
框 (Frame) 動畫
21.
補間 (Tween) 動畫 影像變化有規律,如移動、旋轉、縮放等。 可自動產生變化過程中的影像。 Android
提供四種補間動畫:移動、縮放、旋轉、透明度。 Example: translate_tween 、 scale_tween 、 rotate_tween 、 alpha_tween 。
22.
Property Animation Android 3.0
之後提供的 新動畫架構。
23.
Property Animation 屬性名稱: 1 )
translationX 和 translationY :控制了 View 所處的位置,它 的 是由们 值 layout 容器設 置的,是相對於坐標原點( 0 , 0 左上角)的偏移 。值 2 ) rotation, rotationX 和 rotationY :控制 View 繞著軸點旋轉。 3 ) scaleX 和 scaleY :控制 View 對於 pivotX 和 pivotY 的 放。缩 4 ) pivotX 和 pivotY :旋轉的軸點和 放的基準點。缩 5 ) x 和 y : view 在其父容器中的最 位置,是左上角座標和偏移量终 ( translationX , translationY )的和。 6 ) aplha :透明度, 1 是完全不透明, 0 是完全透明。
24.
25.
XML <?xml version="1.0" encoding="utf-8"?> <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="2000" android:propertyName="scaleX" android:repeatCount="1" android:repeatMode="reverse" android:valueFrom="1.0" android:valueTo="2.0"
> </objectAnimator>
26.
XML
27.
XML ● propertyName :可為目標影像中的任何有 get/set
方法的属性。 ● duration :持續時間。 ● valueFrom 和 valueTo :動畫開始和結束時的相對應 ,若是值 縮 放的話,就是倍數了,平移( Translation )的話,就為距離了。 ● repeatCount 和 repeatMode :重覆模式與次數。
28.
綜合範例 Example: View_anim property_anim
29.
Contact E-mail: pinglunliao [at]
gmail [dot] com LINE: Holan.Liao Skype: pinglunliao FB: https://www.facebook.com/LiaoPingLun
Download now