2013年12月4日 星期三

Construct 2教學:8 direction 4 - bound to layout範例解析

本練習示範限制角色不能移動跑到場景範圍外
建立新專案
a.      New empty project
b.      Saveàbound to layout.capx

決定場景及遊戲畫面尺寸
a.      Layout1Layout Size屬性:640, 480
b.      Project屬性:
Window Size
à640, 480
Fullscreen in browser
àoff

在場景中加入角色
a.      Insert new Objectà General/Sprite
b.      Load an image from a fileà選取player.png
c.       Renameà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

限定player不能超出視窗
a.      點選player
b.      Behaviors
c.       Add newàGeneral/Bound to layout