I want make a limited field, but Game Develop only makes the field as if it was infinite. Also, is there a way to avoid the character leave the borders of the screen?
The most simple solution is to create obstacles and then make them invisible using the action to hide objects.
You can also center the camera on a “Camera” object and then prevent this “Camera” object to leave the field by checking its X/Y coordinates :
[code]Conditions : None
Actions : Set X/Y position of Camera to the X/Y position of Hero
Center the camera on Camera object
Conditions : The X position of Camera is > 800
Actions : Set X position of Camera to 800
Conditions : The X position of Camera is < -500
Actions : Set X position of Camera to -500
…[/code]
Thank you for the help, 4ian.
It worked, except for a minor detail: the camera shakes a lot when it doesn’t reach the limit. Is there a way to fix it?
It is surely because the hero/player is moved ( according to the forces applied on it ) after the events, and the Camera object is not following this movement.
To fix it, at the end of the events, add an event with an action “Make objects moving” ( Category All objects > Displacement if I remember correctly ) ( No conditions ).
Then, move the events related to the Camera objects ( That is too say, the events I’ve written above ) after this event.
Just to inform I’ve fixed it, sadly I needed to focus the camera on the character instead of the camera object. But it’s working now.
Thank you, Mr 4ian for supporting the community.