Gurigraphics
Gurigraphics
# 14 | How import a tilemap ## Game.resources.js Import the **tileset.png** and **map.tmx** ```Javascript Game.res = { HelloWorld_png : "res/HelloWorld.png", map_png : "res/tileset.png", map_tmx : "res/map.tmx" }; Game.g_resources =...
# 13 | How create a tilemap ## Step 1 Save this image in folder "res" as "**tileset.png**"  ## Step 2 Download the **Tiled**, export and...
# 12 | How use keyboard to move a sprite ## Game.scenes.js Add the update method in **Game.scenes.js** ```Javascript Game.scenes[1].extend = cc.Scene.extend({ onEnter:function () { this._super(); var layer = new...
# 11 | How to do scene transition Example scene transition on click or touch ```Javascript if (cc.rectContainsPoint(targetRectangle, location)) { cc.director.runScene( new Game.scenes[2].extend() ); } ``` Example scene transition with...
# 10 | How to Replace Sprites Set the source and tag of each sprite ```Javascript this.initWithFile("res/01.png"); this.setTag("02"); this.initWithFile("res/02.png"); this.setTag("01"); ``` Example replace the image with the touch ```Javascript if...
# 09 | How to use touch event ## Game.layers.js Edit the **Game.layers.js** Add to sprite that has been extended the listener. > In a complex project the ideal is...
# 08 | How to extend the attributes of a sprite ## Game.layers.js Edit the **Game.layers.js** ```Javascript Game.layers[1].extend = cc.Layer.extend({ init: function () { this._super(); var game = this; Game.layers[1].start(...
# 07 | How to remove a sprite of screen ## Game.layers.js Edit the **Game.layers.js** To remove a sprite you need to add a sprite to a layer, and the...
# 06 | How to Move a Sprite on the Screen ## Game.layers.js In the **Game.layers.js** a) set the time of movement b) set the horizontal distance of the movement...
# 05 | How to define the attributes of an object There are 3 ways to define and edit the attributes of an object ## Mode 1 ```Javascript var sprite...