2014年1月22日 星期三

Construct 2教學:解析Platform 2 - scrolling範例

本範例展示平台遊戲中的場景捲動(Scroll To)功能
建立新專案
a. New empty project
b. Saveàplatform 2 - scrolling.capx

決定場景及遊戲畫面尺寸
a. Layout1之Layout Size屬性:1280, 1024
b. Project屬性:
Window Sizeà640, 480
Fullscreen in browseràoff
Nameàplatform 2 - scrolling

在場景中加入跳板物件
a. Insert new Objectà General/Sprite
Load an image from a fileà選取block.png
b. Nameàboard
c. Sizeà240, 35
d. Behaviors
Add newàAttributes/Solid

Ctrl-drag複製5個board
適當調整6個board物件位置

加入玩家物件
a. Insert new Objectà General/Sprite
Load an image from a fileà選取gear.png
b. Nameàplayer
c. Sizeà48, 48
d. Behaviors
Add newàMovements/Platform

玩家掉落平台後自動重生
a. 切換到Event sheet
b. Add event
playeràSize & Position/Is outside layout
c. Add action
Playerà Size & Position/Set positionà130, 180

讓場景跟隨玩家捲動
a. 切換到Layout
b. 點選player
c. Behaviors
Add newàGeneral/Scroll To