We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the Game.layers.js a) Take the dimensions of the canvas b) Define the positions x and y c) Define the value of the anchor
Game.layers[1].extend = cc.Layer.extend({ init: function () { this._super(); var game = this; Game.layers[1].start( game ); } }); Game.layers[1].start = function( game ){ var size = cc.director.getWinSize(); //a var sprite = new cc.Sprite ( "HelloWorld.png" ); sprite.attr({ x: size.width / 2, //b y: size.height / 2, anchorX: 0.5, //c anchorY: 0.5 }); game.addChild(sprite); };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
04 | How to center a sprite in Screen
Game.layers.js
In the Game.layers.js
a) Take the dimensions of the canvas
b) Define the positions x and y
c) Define the value of the anchor
The text was updated successfully, but these errors were encountered: