Hi,
Suggestion: Remove "center.x = -center.x;"
I only messed about with this for a bit so I'm not 100% sure if this is going to work or not. I think the problem may be the last line "center.x = -center.x" which I think you need to remove. After doing some investigating in the inspector you shouldn't need to mess with the collider at all, shifting the localscale to a negative value on the transform will lead to the collider shifting accordingly.
I'm still rather new to this so I can't tell you exactly what the issue with the last line is, but I was able to make a quick build that just flips back and forth when I press space without the sprite disappearing.
↧