Better way to add padding

isntead of saying
leftmostx + padding;
you can say
leftmostx + this.transform.localScale.x / 2; and rightmostx - this.transform.localScale.x / 2;

that way you can change the size of the rocket and code will continuously work

This is better, but not as good as using the actual sprite’s size. See my post here:

Privacy & Terms