dude78 Posted September 9, 2018 Share Posted September 9, 2018 Hello guys. I use: this.load.atlas('spriteName'); to load a sprite. To see its bounds and body (for interacting with other objects) we can use: this.debug.body('spriteName'); this.debug.spriteBounds('spriteName'); At the beginning these sizes are the same but we can change body size in such a way: (docs) this.spriteObject.body.setSize(width, height [, offsetX] [, offsetY]); The question: how to change sprite bounds? Is there any way? Thanks in advance. Link to comment Share on other sites More sharing options...
dude78 Posted September 18, 2018 Author Share Posted September 18, 2018 Guys? Any ideas? Link to comment Share on other sites More sharing options...
Yehuda Katz Posted September 19, 2018 Share Posted September 19, 2018 @dude78 sometimes it looks like this forum is dead What do you mean by changing sprite bounds? You cannot change texture size but you can change size of sprite which uses it. Lets say you have 'character.png' image 100x200 pixels size. Once you load it, it will have 100x200 pixel size texture. You can create sprite using this texture and by default it will be also 100x200 but you can easily change its width/height by my_sprite.width =150 or my_sprite.scale.x = 0.7 to make its width 100*0.7 = 70 pixels. That will change sprite's bounds... also you can directly change x/y propery of sprite to move it around screen and that will also affect bounds. If I understand your question wrongly, just let me know. Link to comment Share on other sites More sharing options...
dude78 Posted September 19, 2018 Author Share Posted September 19, 2018 @Yehuda Katz, yep, dead . I meant different thing, I'll explain later. 'Cause I think, most people understand this question wrong... I'll edit post and call for you when a simple sprite for this question will be done, it must be today. I hope with new explanation and example the problem will be clear :). Link to comment Share on other sites More sharing options...
Milton Posted September 19, 2018 Share Posted September 19, 2018 Link to comment Share on other sites More sharing options...
Recommended Posts