SarEngine2D

Document

SarEngine2D Background

Background

作为场景的渲染背景图层,可以相对画面静止,或者以较低的速度随摄像机移动。若干个不同速度随摄像机移动的背景可以带来距离层次感。

Syntax

//from global
var background = new Background();
//from SarEngine
var background = new SarEngine.Background();

Properties

coordinate
Coordinate 背景所处的坐标系。
followSpeed
Number 表示背景随摄像机移动速度的比率,值域0~1。1将完全跟随摄像机,即相对画面静止。0将不跟随摄像机移动,固定于场景中。
objectList
Array 在该背景图层中的游戏对象的数组集合。
scene
Scene 该背景所在的场景。

Methods

addGameObject(gameObject, zIndex)
向该背景图层中添加游戏对象。
removeGameObject(gameObject)
将指定的游戏对象从该背景图层中移除。
render(graphics, dt, camera, output)
通过指定的摄像机和曝光时间渲染该背景图层到指定的输出接口。