Stop Platformer character from backtracking

I am trying to make a Super Mario Bros fan game a remake of the original most of the events are working pretty well but I am trying to prevent the Platform Character from backtracking to the left like in the original but am having issues with working out how to implement this.

I tried creating a platform object to the left of the character but this didn’t have the desired results

I have an idea but not sure if it would work or even if it’s possible.

So the question is if it is possible to say only let the character walk several steps to the left then stop them walking any future.

Is it possible to do this using a variable or is using a camera the better option.

this is my camera events.

Any help appreciated

Assuming you want camera to only go right but not left

You could create scene variable called Xpos
Now you would set that variable to Player X position
With condition that Variable Xpos is less than player X position

This would update Xpos variable only if player moved further right than it he ever was

And now you would use condition to check player X position if it is greater than variable Xpos
And in action you change camera position to Player.CenterX()

Centering camera on player on Y axis need separate event

This is your logic for moving camera only right as player advances

You would need to center camera on player at beginning of scene
Yet for rest of the level you would use that logic

As for blocking with left screen border
You could create some object give it platform behavior
So it act as wall

You place it on your scene and you change its X position to CameraBorderLeft()-NameOfThatObject.Width()
And Y position to CameraBorderTop()
Without any condition

Now you also need to change either in editor or via event height of this object
For event you would change its height to CameraHeight()
And now it will be perfectly hidden on the left side of your screen beyond left border so you will never see it and it will block player from going left

This worked for me. Same concept but using the camera left. It uses a variable to change the camera left enforcement.

1 Like

Thank you works perfectly spent hours trying everything I could think of.

1 Like