I use this to set up padding:
var halfWidth = GetComponent<SpriteRenderer>().bounds.extents.x; xmin = leftmost.x + halfWidth; xmax = rightmost.x - halfWidth;
Figured it out during previous lesson. It should work even when you change ship’s sprite.
I thought about that improvement, too, but didn’t get as ambitious as you.
Thanks for introducing me to the “extents” property of the Sprite Renderer!
Thank you so much for this! I expanded this idea to change a sprite’s scale (for things like power ups or debuffs) in the script itself and adjust the xmin and xmax values to accomodate the changes in realtime.
https://pastebin.com/hBYBDeyq
Here is a quick video of what it looks like: