本練習示範物件之8 Direction自動面向滑鼠游標
建立新專案
a.
New empty project
b.
Saveàlook
at mouse.capx
決定場景及遊戲畫面尺寸
a.
Layout1之Layout Size屬性:640, 480
b.
Project屬性:
Window Sizeà640, 480
Fullscreen in browseràoff
Window Sizeà640, 480
Fullscreen in browseràoff
在場景中加入角色
a.
Insert new Objectà General/Sprite
b.
Load an image from a fileà選取player.png
c. Nameàplayer
設定player行為
a.
Behaviors
b.
Add newàMovements/8
Direction
c.
Set angleàNo
加入滑鼠物件
a.
Insert new Objectà Input/Mouse
使player隨時面向滑鼠游標
a.
切換到Event sheet
b.
Add eventàSystemàGeneral/Every tick
c.
Add actionàplayeràAngle/Set angle toward positionàMouse.X, Mouse.Y