1
Support / Re: Trouble getting sprite dimensions
« on: February 15, 2013, 01:14:36 am »
Thanks! That fixed it.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
With the tk2dCamera, there is no camera scale applied - it is the camera that is tweaked to get stuff to fit / moved around and so on.
var gameObj:GameObject;
var tk_spr:tk2dSprite;
var tempTexture:Texture2D;
tempTexture = Resources.Load( "Textures/MENUS/"+spr_str, Texture2D );
var tSize:Rect = new Rect(0, 0, tempTexture.width, tempTexture.height);
var tAnch:Vector2 = new Vector2(0, tempTexture.height);
gameObj = tk2dSprite.CreateFromTexture( tempTexture, tk2dRuntime.SpriteCollectionSize.Explicit( tempTexture.width, tempTexture.height ), tSize, tAnch );
gameObj.name = spr_str.ToString();
gameObj.layer = LayerMask.NameToLayer("MENU");
tk_spr = gameObj.GetComponent(tk2dSprite);
tk_spr.collection.transform.parent = gameObj.transform;
tk_spr.pixelPerfect = true;