My sprite moves to the left, as it should but it stops moving and does not go offscreen, as I want it to. It's as if there is an invisible wall.
I have tried https://www.youtube.com/watch?v=YfIOPWuUjn8.
In the video, the person's sprite completely moves off the screen but mine doesn't.
public Sprite Pokemon_0;
public Sprite Pokemon_1;
void Update()
{
if (transform.position.x >= -40)
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = Pokemon_0;
transform.Translate(-1f,0f,0f);
}
I am working on the sprite moving off the screen on the left, and a different sprite appearing from the right and moving to the centre of the screen. The code doesn't include anything about the second sprite but that is why I have referred to the sprite in my code.