GMS 2 camera view in new rooms?

Dwighty4000

Member
I have a game with a limited camera view that tracks only the player. What do I have to program if I want to enter a new room and the camera should follow now follow the player in the next room along?
 

samspade

Member
This really depends upon how all the rest of your code is set up. For the camera system I use nothing would change at all. So you'll need to post your code.
 

Dwighty4000

Member
This really depends upon how all the rest of your code is set up. For the camera system I use nothing would change at all. So you'll need to post your code.
If I now go through a door that brings me into a no room, then I would now ever prevent the camera gets stuck in the old room
 

samspade

Member
If I now go through a door that brings me into a no room, then I would now ever prevent the camera gets stuck in the old room
That is a very strange sentence. I'm not even sure how to answer it.
  • What is a door?
  • What do you mean by room?
  • How does a camera get stuck?
With the exception of room, none of those are built into GM, so you'll have to explain what you mean, and again post your code, if you want an answer. Also the way you're using the word room makes me wonder if you are referring to a GM room or something else.

A GM camera cannot get stuck on anything. You can't even code it to 'get stuck' on something. You could make it track an object and have that object get stuck on something, but the camera can't. Also, camera's don't go from room to room, at least not if you're using the built in ones (which you should be). You just want code that takes a GM camera in a room and points it to whatever you want. Also, only persistent objects go from room to room. If your player is persistent then its id won't change so there would be no issue. If it is not persistent, then it is as simple as finding the id of the new player instance, or if there is only one, using the object id.
 

Dwighty4000

Member
That is a very strange sentence. I'm not even sure how to answer it.
  • What is a door?
  • What do you mean by room?
  • How does a camera get stuck?
With the exception of room, none of those are built into GM, so you'll have to explain what you mean, and again post your code, if you want an answer. Also the way you're using the word room makes me wonder if you are referring to a GM room or something else.

A GM camera cannot get stuck on anything. You can't even code it to 'get stuck' on something. You could make it track an object and have that object get stuck on something, but the camera can't. Also, camera's don't go from room to room, at least not if you're using the built in ones (which you should be). You just want code that takes a GM camera in a room and points it to whatever you want. Also, only persistent objects go from room to room. If your player is persistent then its id won't change so there would be no issue. If it is not persistent, then it is as simple as finding the id of the new player instance, or if there is only one, using the object id.
At first I just wanted to be sure because I once had such a problem but your information that the camera is not tied to the room but only on a project has helped me a lot further!
Thanks.
 
Top