分析:

边界层用于确定每个游戏层的边界,以便区分不同游戏层

这里设置为(屏幕宽,140)Edge.h

#include <iostream>

#include <cocos2d.h>

using namespace cocos2d;

class Edge:public Node {

public:

virtual bool init();

CREATE_FUNC(Edge);

};

Edge.cpp#include “Edge.h”

bool Edge::init(){

Node::init();

Size visibleSize = Director::getInstance()->getVisibleSize();

Size s = Size(visibleSize.width,140);

setContentSize(s);

setPhysicsBody(PhysicsBody::createEdgeBox(s));

return true;

}

暂时的效果(留意边界)