12
Dept. of Electronics Engineering Construct 2 8Direction behavior 電子工程系電腦遊戲設計組 吳錫修 2014.4.23

8direction behavior

Embed Size (px)

DESCRIPTION

介紹Construct 2之8 direction行為模組功能,包括屬性、事件條件及事件動作

Citation preview

Page 1: 8direction behavior

Dept. of Electronics Engineering

Construct 2 8Direction behavior

電子工程系電腦遊戲設計組

吳錫修

2014.4.23

Page 2: 8direction behavior

8 direction行為 1/2

8 direction行為模組賦予物件上、下、左、右和對角線方向移動能力,也可以設定為上、下、左、右4個方向移動或簡單的上/下移動或左/右移動

預設是以方向鍵控制物件移動

Wu, ShyiShiou2

Page 3: 8direction behavior

8 direction行為 2/2

經常應用在由上向下視角之遊戲中

當按著方向鍵時,物件開始加速移動,直到上限速度

放開方向鍵時,移動中的物件開始減速,直到停止

按下與目前移動方向相反的方向鍵時,物件開始減速,停止之後朝反方向移動

Wu, ShyiShiou3

Page 4: 8direction behavior

8 direction properties 1/3

用來調整8 direction行為參數

Max speed物件最大移動速度,單位pixels/second,預設值200

Acceleration加速度,單位pixels/second2 ,預設值600

Deceleration減速度,單位pixels/second2 ,預設值500

Directions設定物件移動模式:

Up & down 物件只能上/下移動

Left & right 物件只能左/右移動

4 directions 物件只能上、下、左、右4個方向移動

8 directions 物件可上、下、左、右及對角線8個方向移動,此為預設值Wu, ShyiShiou4

Page 5: 8direction behavior

8 direction properties 2/3

Set angle物件移動時物件角度調整方式,有四種不同的模式:

No物件移動時不改變物件角度值

90-degree intervals當向上移動時,物件角度值變為270度;當向下移動時,物件角度值變為90度;當向左移動時、物件角度值變為180度;當向右移動時,物件角度值變為0度。

45-degree intervals物件可朝上/下/左/右及對角線8個方個,每個方向旋轉45度

360 degree (smooth) 物件移動時平滑調整物件角度,使物件永遠向著運動的角度,此為預設值

Wu, ShyiShiou5

90

270

180 0

315

45135

225

Page 6: 8direction behavior

8 direction properties 3/3

Default controls是否使用預設的方向鍵來控制物件移動。

設為No時,必須在事件表中使用Simulate control來控制物件移動

Initial state是否在一開始就啟用8 direction行為模組功能

Wu, ShyiShiou6

Page 7: 8direction behavior

8 direction conditions

提供給事件表的事件條件

Compare speed比對物件目前的speed屬性值,單位pixels/second

Is moving檢查物件目前是否處於移動狀態

Wu, ShyiShiou7

Page 8: 8direction behavior

8 direction actions 1/3

事件表中可用的actions

Reverse反轉物件運動方向。可用來產生物件碰到障礙物時彈回效果

Set acceleration變更物件的加速度,單位pixels/second2

Set deceleration變更物件的減速度,單位pixels/second2

Set max speed變更物件的速度上限,單位pixels/second

Set enabled啟用或禁用物件8 direction行為

Wu, ShyiShiou8

Page 9: 8direction behavior

8 direction actions 2/3

Set ignoring input設定是否忽略按鍵輸入。當輸入被忽略,按任意控制鍵沒有作用;然而物件可以繼續移動

Set speed變更物件的速度,單位pixels/second

Set vector X變更物件的X軸分量速度,單位pixels/second

Set vector Y變更物件的Y軸分量速度,單位pixels/second

Simulate control模擬按下移動控制鍵(上、下、左、右方向鍵)。通常應用在Default controls屬性值為No時。

Wu, ShyiShiou9

Page 10: 8direction behavior

8 direction actions 3/3

Stop使物件速度變為0

Wu, ShyiShiou10

Page 11: 8direction behavior

8 direction expressions 1/2

物件實體在Runtime時的8 direction行為資料

Acceleration取得物件之加速度設定值

Deceleration取得物件之減速度設定值

MaxSpeed取得物件之上限速度設定值

MovingAngle取得物件目前的移動角度

Speed取得物件目前的移動速度

Wu, ShyiShiou11

Page 12: 8direction behavior

8 direction expressions 2/2

VectorX取得物件目前的X軸分量速度值

VectorY取得物件目前的Y軸分量速度值

Wu, ShyiShiou12