Of I add sprite as physics body.. what width and height does it take?
I have a sprite sheet in which all frames are 80x80
Ssome frames have visible pixes only on 40x80 rectangle in the middle part of sprite. When i make this sprite physics body it takes the dimensions of the body to be 40x80 instead of 80x80.
Any idea how to make it take actual sprite size?
Following is my descriptor file if that helps.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | function getSpriteSheetData() local d = 20 local sheet = { frames = { { name = "s.png", spriteColorRect = { x = d, y = d, width = 2*d, height = 3*d }, textureRect = { x = 0, y = 0, width = 2*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "fs.png", spriteColorRect = { x = d, y = d, width = 2*d, height = 3*d }, textureRect = { x = 0, y = 7*d, width = 2*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "sw.png", spriteColorRect = { x = 0, y = d, width = 3*d, height = 3*d }, textureRect = { x = 120, y = 4*d, width = 3*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "fsw.png", spriteColorRect = { x = 0, y = d, width = 3*d, height = 3*d }, textureRect = { x = 120, y = 11*d, width = 3*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "w.png", spriteColorRect = { x = 0, y = d, width = 3*d, height = 3*d }, textureRect = { x = 0, y = 4*d, width = 3*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "fw.png", spriteColorRect = { x = 0, y = d, width = 3*d, height = 3*d }, textureRect = { x = 0, y = 11*d, width = 3*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "nw.png", spriteColorRect = { x = 0, y = 0, width = 3*d, height = 4*d }, textureRect = { x = 4*d, y = 0, width = 3*d, height = 4*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "fnw.png", spriteColorRect = { x = 0, y = 0, width = 3*d, height = 4*d }, textureRect = { x = 4*d, y = 7*d, width = 3*d, height = 4*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "n.png", spriteColorRect = { x = d, y = 0, width = 2*d, height = 4*d }, textureRect = { x = 2*d, y = 0, width = 2*d, height = 4*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "fn.png", spriteColorRect = { x = d, y = 0, width = 2*d, height = 4*d }, textureRect = { x = 2*d, y = 7*d, width = 2*d, height = 4*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "ne.png", spriteColorRect = { x = d, y = 0, width = 3*d, height = 4*d }, textureRect = { x = 7*d, y = 0, width = 3*d, height = 4*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "fne.png", spriteColorRect = { x = d, y = 0, width = 3*d, height = 4*d }, textureRect = { x = 7*d, y = 7*d, width = 3*d, height = 4*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "e.png", spriteColorRect = { x = d, y = d, width = 3*d, height = 3*d }, textureRect = { x = 3*d, y = 4*d, width = 3*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "fe.png", spriteColorRect = { x = d, y = d, width = 3*d, height = 3*d }, textureRect = { x = 3*d, y = 11*d, width = 3*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "sw.png", spriteColorRect = { x = d, y = d, width = 3*d, height = 3*d }, textureRect = { x = 9*d, y = 4*d, width = 3*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, { name = "fsw.png", spriteColorRect = { x = d, y = d, width = 3*d, height = 3*d }, textureRect = { x = 9*d, y = 11*d, width = 3*d, height = 3*d }, spriteSourceSize = { width = 4*d, height = 4*d }, spriteTrimmed = true, textureRotated = false }, } } return sheet end |