Hi,
In cocos2D, I used the following code to move the camera in order to track a sprite accross the game layer:
`-(void)centerCamera:(CGPoint)center{
CGSize winSize = [CCDirector sharedDirector].winSize;
center.x -= (winSize.width / 2);
center.y -= (winSize.height / 2);
[self.camera setCenterX:center.x centerY:center.y centerZ:0];
[self.camera setEyeX:center.x eyeY:center.y eyeZ:1];
}`
I expected the following to achieve the same result; However, it doesn’t cause the camera to move around the game layer:
@
var MainLayer = cc.LayerColor.extend( {
// …
centerCamera: function(center){
var winSize = cc.Director.getInstance().getWinSize()
center.x = ;= (winSize.height / 2);
center.y
this.getCamera().setCenterXYZ(center.x, center.y, 0);
this.getCamera().setEyeXYZ(center.x, center.y, 1);
},@
How is this supposed to work in CC2Dx-HTML5?
thanks!
J.