Fangames > Programming Questions
Camera following player
(1/1)
IceFreaki:
Hey there~
So I'm using the Yuuutu Engine and I want the camera to follow the player.
I've got it working, kinda. The thing is, after the player dies, the camera snaps to the top left of the room.
I had this problem before years ago but I used a different engine where the bow would stay put where you died.
Back then I just made the bow be there in any difficulty and made it invisible and let the camera follow that thing. Worked like a charm.
But in Yuuutu's Engine the bow also seems to go to the top left or something.
Is there any way to fix that so that the camera stays where the player died?
Thanks for the help!
Derf:
Hey!
There's a board specifically for Game Maker questions now over here https://www.iwannacommunity.com/forum/index.php?board=51.0. You could have christened it as well!
Anyway, to solve your problem create an invisible object called "objCamFollow" or whatever you prefer. Make it invisible and make sure it spawns in every room you want the scrolling camera to work. Set the room to follow this object instead of the player. In the step event of this object put the following code:
--- Code: ---if(instance_exists(player)){
x = player.x;
y = player.y;
}
--- End code ---
That should work just fine for you :~)
IceFreaki:
Thanks a lot, works perfectly!
Didn't even notice the board, I'll make sure to post there next time I have a GM specific question~
One thing though, is there a possible fix for the GAME OVER to show up correctly when using that method?
It's not really that bothersome, but the GAME OVER sometimes is a bit offset.
Thanks again!
Derf:
No problem!
I'd put the following code in the game over object's step event:
--- Code: ---x = view_xview+400;
y = view_yview+304;
--- End code ---
Navigation
[0] Message Index
Go to full version