![]() This.sprite = cc.Sprite.createWithSpriteFrameName("00. I'm loading the spritesheets this way: var cache = cc.SpriteFrameCache.getInstance() Ĭache.addSpriteFrames("ist", "srcSprites/spritesheet.png") So if I will load a sprite with at the left side 20px of transparent area a setPosition to X = 0 will put the sprite 20px far from the left border, so ? Well it do not work for me, and in cocos2d the trasparent area is not considered. The sprite position will be relative to the original transparent area and not the colored area ? Is this right. "All the transparent background is removed and the information about the position of the colored area within the original sprite is saved in the plist file"Īs I load the plist file in COCOS2d, the position of the colored area is remembered and if I do in cocos2d: tPosition(new cc.p(0,0)) But as I understand the trim mode in Texturepacker: "Crop Keep position" should work this way: Please do not use Crop, flush position, or the trim information will be lost and you can't get back originial texture offset anymore.I cannot figure out how it works. The sprite view updates each time you add new sprites to the folder, rename or change sprites. TexturePacker scans it for known image formats such as png, jpg, psd, svg, bmp, tiff and others. In TexturePacker before you publish your sprite sheet, please make sure you choose Trim in Trim Mode setting of Sprites section. Drop your sprites Drag & drop a folder containing your sprites on the left pane. We recommend users to use sprite sheet tools such as TexturePacker for generating sprite animation texture assets. If Trim property is set to true, it would fit animations that have no in texture offset. This way when playing sprite animation the sprite node position will not change, instead the character will move based on it's offset in original textures. We should set Sprite component's Trim property to false, and set Size Mode to RAW. In this case, all animation frames are textures with the same size and transparent areas around the character. Usually animator will use a large canvas and put character on different positions on the canvas for different animation frames. There are a lot of animator prefer to draw the moving motion in texture, commonly seen in attack animations. The following picture shows the comparison of two size modes: If user use Rect Transform Tool or Size property in Properties panel to modify the size of the node, the Size Mode property will be automatically set to CUSTOM. The crop is a rectangle that limits the area of the texture frame that is visible. CUSTOM This option make sure the size of the node will not be changed along with SpriteFrame, and should be managed by user himself. Applies a crop to a texture based Game Object, such as a Sprite or Image.RAW Select this option will set the size of the node to use the original texture size, including transparent areas. ![]() TRIMMED Select this option will set the size of the node to use trimmed image size of the current SpriteFrame used by Sprite component. Please do not use Crop, flush position, or the trim information will be lost and you can't get back originial texture offset anymore.Size Mode Use the options in this property to set node's size to the original texture size or trimmed image size.If unchecked the bounding box will be showing original texture including transparent areas. Instead the bounding box will be an exact fit to trimmed image. Trim If checked, the node's bounding box will not include transparent pixels around the image.There are two properties related to trim setting in Sprite component: ![]() Trim Related Properties in Sprite Component ![]() This will help us get the exact node size we need for Sprites. Any fully transparent pixels around the image will be cropped. Once a texture is imported, the SpriteFrame asset generated with the texture will be trimmed automatically. Resource management considerations - meta files 1 Answer Sorted by: 2 This is as it should be - no bug -) TexturePacker has 2 crop modes in Unity - to remove transparency around the sprites which consumes memory and GPU.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |